sam
sam

Reputation: 75

C++ compiler cannot find Boost libraries even after installing them

While compiling few test applications, I get the following error:

g++: error: −lboost_system: No such file or directory
g++: error: −lboost_filesystem: No such file or directory

while running the following command:

g++ -I/usr/include/boost/ -L/usr/lib/x86_64-linux-gnu/  aescuda.cpp -o test.o −lboost_system −lboost_filesystem

The libraries are installed and present in location as shown below:

<prompt>$ ll  /usr/lib/x86_64-linux-gnu/libboost_system.*
-rw-r--r-- 1 root root 49178 Jun 20  2014 /usr/lib/x86_64-linux-gnu/libboost_system.a
lrwxrwxrwx 1 root root    25 Jun 20  2014 /usr/lib/x86_64-linux-gnu/libboost_system.so -> libboost_system.so.1.54.0
-rw-r--r-- 1 root root 14536 Jun 20  2014 /usr/lib/x86_64-linux-gnu/libboost_system.so.1.54.0
<prompt>$ ll  /usr/lib/x86_64-linux-gnu/libboost_filesystem.*
-rw-r--r-- 1 root root 217628 Jun 20  2014 /usr/lib/x86_64-linux-gnu/libboost_filesystem.a
lrwxrwxrwx 1 root root     29 Jun 20  2014 /usr/lib/x86_64-linux-gnu/libboost_filesystem.so -> libboost_filesystem.so.1.54.0
-rw-r--r-- 1 root root  88936 Jun 20  2014 /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.54.0

Can anyone suggest where am I going wrong :(

Upvotes: 3

Views: 1558

Answers (1)

Florian Weimer
Florian Weimer

Reputation: 33717

You have a wrong character in front of the l:

−lboost_system

It should be an ASCII hyphen:

-lboost_system

This causes the compiler driver to treat the whole string as an input file name (which obviously does not exist, hence the No such file or directory error), and not as an option to be passed to the linker.

(Perhaps consider switching the terminal font.)

Upvotes: 3

Related Questions