문제

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.

도움이 되었습니까?

해결책

-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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top