User forums > Using Code::Blocks

error adding symbols: DSO missing from command line

<< < (2/3) > >>

BlueHazzard:
and to clear things up:

--- Code: ----pthread
--- End code ---
is a compiler setting

--- Code: ---pthread
lpthread
--- End code ---
is nothing....

--- Code: ----lpthread
--- End code ---
is a library called "pthread" or "libpthread" or some other derivative names. The "-l" in front indicates a library to the compiler/linker. This "-l" is added automatically by codeblocks if you add a library in the linker settings

--- Code: ---'pthread'
--- End code ---
is nothing (it could be that it gets interpreted by the compiler or the shell i am not sure here. i would have to test it on linux)


--- Code: ---`pthread`
--- End code ---

this gets executed by codeblocks in a shell and the output of the shell is passed as command to the linker/compiler so anything inside the `` should run in  shell or it wont work.

oBFusCATed:
One correction: -pthread must be passed to both compiler and linker. So it must be set in other compiler options and other linker options. -lpthread might work, but it might not work... For more details read the compiler manual.

niconol:
Hi,
I tried twe two proposal, with no results.

When I started this project on RPI3 + OS raspbian(jessie), I compiled directly on the terminal, with this command line, with success:

--- Code: ---g++ DicTstHsv_v0.0.cpp `pkg-config opencv --cflags` -lwiringPi -o hsv -lmount `pkg-config --libs opencv` -ludev -std=c++11 -lpthread

--- End code ---

then I transfered my project in CB, and add gtkmm libs, in the same card and OS, always with only one file for all my code.
about ptrhread, I use only
--- Code: ---pthread
--- End code ---
in link libraries for "debug"

--- Code: ---g++  -o bin/Debug/Dic_0-81 obj/Debug/main.o obj/Debug/usb_devices.o  -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lgio-2.0 -lcairomm-1.0 -lcairo -lsigc-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0  -I/usr/include/opencv  /usr/lib/arm-linux-gnueabihf/libopencv_calib3d.so -lopencv_calib3d /usr/lib/arm-linux-gnueabihf/libopencv_contrib.so -lopencv_contrib /usr/lib/arm-linux-gnueabihf/libopencv_core.so -lopencv_core /usr/lib/arm-linux-gnueabihf/libopencv_features2d.so -lopencv_features2d /usr/lib/arm-linux-gnueabihf/libopencv_flann.so -lopencv_flann /usr/lib/arm-linux-gnueabihf/libopencv_gpu.so -lopencv_gpu /usr/lib/arm-linux-gnueabihf/libopencv_highgui.so -lopencv_highgui /usr/lib/arm-linux-gnueabihf/libopencv_imgproc.so -lopencv_imgproc /usr/lib/arm-linux-gnueabihf/libopencv_legacy.so -lopencv_legacy /usr/lib/arm-linux-gnueabihf/libopencv_ml.so -lopencv_ml /usr/lib/arm-linux-gnueabihf/libopencv_objdetect.so -lopencv_objdetect /usr/lib/arm-linux-gnueabihf/libopencv_ocl.so -lopencv_ocl /usr/lib/arm-linux-gnueabihf/libopencv_photo.so -lopencv_photo /usr/lib/arm-linux-gnueabihf/libopencv_stitching.so -lopencv_stitching /usr/lib/arm-linux-gnueabihf/libopencv_superres.so -lopencv_superres /usr/lib/arm-linux-gnueabihf/libopencv_ts.so -lopencv_ts /usr/lib/arm-linux-gnueabihf/libopencv_video.so -lopencv_video /usr/lib/arm-linux-gnueabihf/libopencv_videostab.so -lopencv_videostab   -lwiringPi -lmount -ludev -lpthread
Output file is bin/Debug/Dic_0-81 with size 250,33 KB
Process terminated with status 0 (0 minute(s), 11 second(s))
0 error(s), 54 warning(s) (0 minute(s), 11 second(s))
--- End code ---
sucsess!!

then I change my target, always RPI3, always Raspbian (jessie), but an other card, with perhaps some differences about lib installed and version of them.
and my problem occurs with the pthread

I just now compiled this project in the first card, there are a lot of warnings, but a successful compilation !!

To resume, it seems that the behavior is not the same on the two targets (but with the same Hardawre and OS)

I can duplicate my OS to avoid differencies between the two card, but I prefer understand the problem.

How can I check the directories and version of pthread lib? It can be a good thing to check, isn't it?

Best

BlueHazzard:
if you change anything and rebuild and you still get the (or any) error, always post a full rebuild log. We can not help without exact error messages... Now you tell us it is the same error but after discussing 3 days we get the information that it was a different error message (no offense, but i had 1000 discussions with this problem). To not even come remotely in this situation, always post a full rebuild log.

Thanks

PS. With the full rebuild log we can also tell if you put the settings in the right place...

niconol:
All right,
thanks a lot for your help, and sorry for my errors using forum.

Now I'm lost in my too much software versions, 2 targets, using CB compiler/linker options, .... and your proposal (certainly very clear, but not for my understanding level) .. and my bad english.

I'm very grateful for you help.

I decide to restart from a very light software, which works on the two targets and run step by step, with a good logic, and correcting by

--- Quote ----pthread must be passed to both compiler and linker.
--- End quote ---

I update you on my progress

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version