0

I have started working with Neural Networks, so I got a FANN library (http://leenissen.dk/fann/wp/). I am having problems to compile it, specifically file

/fann-master/src/fann_io.c

where I am receiving a error on line 346:

fann_io.c:346:29: error: unable to find string literal operator ‘operator""type’ with ‘const char [20]’, ‘long unsigned int’ arguments if(fscanf(conf, name"="type"\n", val) != 1) \

And I have looked it up, but I still have no idea how to fix it. Here is the function.

#define fann_scanf(type, name, val) \
{ \
    if(fscanf(conf, name"="type"\n", val) != 1) \
    { \
        fann_error(NULL, FANN_E_CANT_READ_CONFIG, name, configuration_file); \
        fann_destroy(ann); \
        return NULL; \
    } \
}
AtomicFS
  • 39
  • 1
  • 2
  • Forgot to mention, I am running Linux (Fedora 25). – AtomicFS Sep 09 '17 at 18:58
  • 2
    It is rather obvious that this C code is being compiled as C++. Something is wrong with this library's build script. – Sam Varshavchik Sep 09 '17 at 19:07
  • It is called many times. One example: fann_scanf("%u", "train_stop_function", &tmpVal); – AtomicFS Sep 09 '17 at 19:10
  • OK, I can compile manually (with GCC). But then how do I use it in C++ code? I can't not include that, not even in the G++ command. Or can i? – AtomicFS Sep 09 '17 at 19:13
  • If name and type parameters are in "name", "type" quotes, then fscanf gets called with `"name""=""type""\n"` which the compiler (in some early phase) changes to `"name=type\n"`, which should work. – Yunnosch Sep 09 '17 at 19:16
  • OK, I figured finally. I have to use g++ main.cpp -std=c++03 – AtomicFS Sep 09 '17 at 19:30

1 Answers1

2

The solution which helped me was to use compiler option

-std=c++03

So in the end I could compile the whole project by typing in

g++ main.cpp -std=c++03
AtomicFS
  • 39
  • 1
  • 2