How do you compile Boost C++ code in Ubuntu?
Greetings, I cannot compile my Boost C++ code. Initially, it complains of “undefined reference”. When I try to resolve this by including the library, I get the "/usr/bin/ld: cannot find -lboost_system" error. From the Terminal: Go Bears >echo $LD_LIBRARY_PATH /usr/lib/libboost_system.so Go Bears >make all g++ -L/usr/lib -lboost_system get_sys_info.cpp /usr/bin/ld: cannot find -lboost_system collect2: ld returned 1 exit status make: *** [all] Error 1 Go Bears > Do you know what stupid mistakes did I make?
From my Makefile: all: g++ -L/usr/lib -lboost_system get_sys_info.cpp ./a.out
Thank you so much, and have an awesome day!
On 7 February 2013 10:06, Giovanni
Greetings, I cannot compile my Boost C++ code.
Do you mean Boost C++ code, thus building Boost libraries, or you mean your code that *uses* Boost libraries? Unclear.
Initially, it complains of “undefined reference”. When I try to resolve this by including the library, I get the "/usr/bin/ld: cannot find -lboost_system" error.
So, looks like the former, you are trying to use the libraries.
From the Terminal: Go Bears >echo $LD_LIBRARY_PATH /usr/lib/libboost_system.so
Where do you get this from? "LD_LIBRARY_PATH, which is a colon-separated list of directories" [1] [1] http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
Go Bears >make all g++ -L/usr/lib -lboost_system get_sys_info.cpp
Have you installed it first? sudo apt-get install libboost-system-dev Best regards, -- Mateusz Loskot, http://mateusz.loskot.net
participants (2)
-
Giovanni
-
Mateusz Loskot