错误:..“va_list”尚未声明

问题描述 投票:0回答:1

我一直在尝试编译 flann 但出现了这个错误! ''va_list' 尚未声明' 任何人都可以帮我解决这个错误吗? 如果可以的话,请告诉我这么简单,我真的是编程新手!

In file included from ./flann/nn/index_testing.h:41,
                 from ./flann/flann.hpp:43,
                 from src/common.hpp:12,
                 from src/main.cpp:9:
./flann/util/logger.h:74: error: 'va_list' has not been declared
Makefile:43: recipe for target `src/main.o' failed
make: *** [src/main.o] Error 1

这里是logger.h

#ifndef LOGGER_H
#define LOGGER_H

#include <cstdio>
#include "flann/general.h"


namespace flann
{

class Logger
{
    FILE* stream;
    int logLevel;

public:

    Logger() : stream(stdout), logLevel(LOG_WARN) {};

    ~Logger()
    {
        if (stream!=NULL && stream!=stdout) {
            fclose(stream);
        }
    }

    void setDestination(const char* name)
    {
        if (name==NULL) {
            stream = stdout;
        }
        else {
            stream = fopen(name,"w");
            if (stream == NULL) {
                stream = stdout;
            }
        }
    }

    void setLevel(int level) { logLevel = level; }

    int log(int level, const char* fmt, ...);

    int log(int level, const char* fmt, va_list arglist);

    int fatal(const char* fmt, ...);

    int error(const char* fmt, ...);

    int warn(const char* fmt, ...);

    int info(const char* fmt, ...);
};

extern Logger logger;

}

#endif //LOGGER_H
c++ variadic-functions flann
1个回答
4
投票

您错过了相关宏的包含

 #include <cstdarg>
© www.soinside.com 2019 - 2024. All rights reserved.