1
votes

I get a strange error while building my Qt C++ project on Ubuntu Linux using GCC 5.2.1:

/usr/bin/ld: cannot find -llibmath

I include external dynamic library to maky qmake project using command:

LIBS += -L/home/rem -llibmath

and I have library file at path /home/rem/libmath.so

As I can see from compiler output:

g++ -Wl,-rpath,/home/rem/Qt/5.5/gcc_64 -Wl,-rpath,/home/rem/Qt/5.5/gcc_64/lib -o Bazis main.o builder.o -L/home/rem -llibmath -L/home/rem/Qt/5.5/gcc_64/lib -lQt5OpenGL -L/usr/lib64 -lQt5QuickWidgets -lQt5Widgets -lQt5Quick -lQt5Gui -lQt5Sql -lQt5Test -lQt5Qml -lQt5Network -lQt5Core -lGL -lpthread

all parameters are correctly send by qmake to g++.

What is the source of my problem?

1
try -lm instead of -llibmathsunny1304
It works!!! But can you explain why?! How linker finds the library without knowing its name?Rem
I am not really sure about the reason, just used to use it like that. sorry :(sunny1304
Unfortunately it doesn't solve my problem - it simply ignores and doesn't link my libraryRem

1 Answers

1
votes

The solution is simple: I changed my .pro file from:

LIBS += -L/home/rem -llibmath

to:

LIBS += -L/home/rem -lmath