c++variadic-functionsflann

Error:.. 'va_list' has not been declared


I'v been trying to compile flann but this error shows up! ''va_list' has not been declared' Can any one help me to solve this error? Plz guild me so simple if u can, I'm really new in programming!

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

Here is 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

Solution

  • You miss an include for the relevant macros

     #include <cstdarg>