开发者

undefined reference to

I have the following problem:

I use a 32 bit version of Qt on a 64 bit Ubuntu. In my Project I want to include the library FCam in order to program for the camera of a Nokia N900 mobile phone. When I include the path to the library in my project file, it seems that Qt does not find it or just does not use it because I get the following error messag开发者_开发问答e:

undefined reference to "FCam::Image::Image(FCam::Image const&)"

My Libs-line looks like this:

LIBS += -lpthread -ljpeg  -Llib -L/home/username/FCam

I have no idea why this does not work, because I have another example project on which it works. I have also tried some variations of the line, but in vain.

Thanks for your answers, Tsveti


With -L/home/username/FCam you are telling the linker to look in that directory when looking for the libraries it should link against. You also need to tell it what library to link agains (that is done with -l). I do not know your lib, but it seems you should add a --lfcam or something like it.


It seems you mixed up the correct order of your libs statement - from the few information I got I would expect this:

LIBS += -L/home/username/FCam -lFCam -lpthread -ljpeg

Why in this order?

Because first you have to define where the libs are by -L[MY_LIB_DIR].

Next you have to add your libs by -lMyLib - where your library file MUST be named libMyLib.a or libMyLib.so.

At last you add the system libs, because it's likely to happen that your app or your libs have dependencies to the system libs lik pthread and jpeg.

Just try the new order and I'm sure you'll get it ;)

ciao, Chris

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜