Pregunta

I want to use functionality of a math library ALGLIB and it's offered in .h and .cpp files. So I build it and added all the .o files to alglib.a. I copied it to my source directory and added these lines to my .pro file:

INCLUDEPATH += /path/to/ALGLIB/cpp/src
LIBS += -Lalglib

Well - I still get those "undefined reference to ..." errors when trying to build.

¿Fue útil?

Solución

-L sets a directory in which the linker should search for libraries.

-l sets a library file to link in the following way: -lalglib will look for a file named libalglib.a in all directories that are set with -L

Adding a file to LIBS without anything will link that exact file.

So either:

LIBS += alglib.a

or, provided that the alglib file name is libalglib.a:

LIBS += -Lalglib-directory -lalglib
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top