1

I try to build an QT project using qmake. For this I need the boost library.

LIBS += -L/usr/lib/ \
 -lboost_system \
 -lboost_filesystem

But after running qmake, these libraries are not added to the makefile:

LIBS = $(SUBLIBS) -L/usr/X11R6/lib64 -lQt5MultimediaWidgets
-L/build/buildd/qtmultimedia-opensource-src-5.0.1/lib -L/usr/lib/x86_64-linux-gnu
-L/usr/lib/x86_64-linux-gnu/x86_64-linux-gnu -lQt5OpenGL -lQt5Multimedia -lpulse
-lQt5Widgets -lQt5Network -lQt5Gui -lQt5Core -lGL -lpthread

As expected, the linker prints many error like

/usr/include/boost/system/error_code.hpp:214: error: undefined reference to boost::system::generic_category()

If you want to take a look to the whole .pro file, go to https://raw.github.com/francisengelmann/FabScan100/master/qtTest/qtTest.pro

I am also having a similar problem with opencv. Does anyone know how to solve this issue ?

smokris
  • 11,740
  • 2
  • 39
  • 59
David
  • 35
  • 1
  • 4
  • I don't think it would make a difference but you have some lines repeated in the .pro file. – Abhishek Bansal Dec 10 '13 at 14:24
  • I did also recognize this, but as you say, deleting these multiple lines doesn't make a difference. – David Dec 10 '13 at 14:28
  • Have you tried deleting your build folder entirely and re-building the project? – Abhishek Bansal Dec 10 '13 at 14:30
  • Yes, I deleted the folder and ran "build project" in qt creator, but the errors are the same. – David Dec 10 '13 at 14:40
  • Which version of qmake are you using? I ran your project file through qmake (3.0) (Qt 5.1.1) on Mac OS X, and I'm not able to reproduce the problem here — `Makefile`'s `LIBS` includes OpenCV and Boost and Point Cloud Library, as expected. – smokris Dec 10 '13 at 15:49
  • Do you see the message produced by `message("Building for Linux.")` statement when running qmake? – Pavel Strakhov Dec 10 '13 at 23:46
  • Thank you very much for you advices, this is a school project so im not able to look these thinks up now. Im going to set up a build enviroment at home but I will need a few days. I'll post those things when this is done. – David Dec 11 '13 at 06:13

1 Answers1

1

You need to run qmake again after changing the .pro file. Just removing your build directory is not enough.

Also are you sure your qmake target is linux-g++? Does the INCLUDEPATH work?

George Y.
  • 11,307
  • 3
  • 24
  • 25
  • I did run qmake after that. Look for my comment on the other answer, I'll test those things when I have a build enviroment at home. – David Dec 11 '13 at 06:15
  • Check the spec your qmake is using. If you're on a 64-bit system, most likely you'd need a spec of linux-g++* (with the star). Or just use linux-* spec, as your headers and libs are not gcc-specific. – George Y. Dec 12 '13 at 06:38
  • Thank you very much, this was the problem. My qmake target was linux-g++64. With linux-g++ it works great. Thank you. – David Dec 17 '13 at 15:56