I had to add extern "C" { #include <iniparser.h> }
in order for the compiler to link correctly.
Linker error with iniparser
-
26-06-2023 - |
Domanda
I am trying to compile a project from source and receiving several undefined reference linker errors
g++ src/Misc/Utils.o src/Misc/Timer.o ... -o bin/nsnake -lncurses -liniparser
src/Config/INI.o: In function `INI::load(std::string)':
INI.cpp:(.text+0xbb): undefined reference to `iniparser_load(char const*)'
...
INI.cpp:(.text+0x726): undefined reference to `iniparser_dump_ini(_dictionary_*, _IO_FILE*)'
collect2: error: ld returned 1 exit status
make: *** [nsnake] Error 1
I have already checked /lib
and /usr/lib
and both contain libiniparser.so.0
and the libiniparser.so -> libiniparser.so.0
symlink. Is there something else I am missing?
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow