1

I already installed libboost, and I made sure the certain library already located in /usr/lib/x86_64-linux-gnu/. I already called #include <boost/filesystem.hpp> in my .cpp file. But, whenever I run this,

g++ -Wall -g -o result.out main.cpp -L/usr/lib/x86_64-linux-gnu -lboost_system

The system gave me

/usr/bin/x86_64-linux-gnu-ld: cannot find -lboost_system collect2: error: ld returned 1 exit status

Realizing it mentioned ld, I checked my /etc/ld.so.conf.d, and I found a configuration file linked to /usr/lib/x86_64-linux-gnu/. I ran sudo ldconfig, then ran the g++ command again, same result.

I don't know what I'm going to do next, so can anyone help me? I'll provide another information related to this if anyone ask. Thanks in advance.

ninnum
  • 13
  • 5
  • 1
    Does file libboost_system.a exist in /usr/lib/x86_64-linux-gnu? – bartop May 28 '18 at 18:47
  • [G++ cannot find boost library](https://stackoverflow.com/q/21261958/608639), [/usr/bin/ld: cannot find -lboost_system-mt](https://stackoverflow.com/q/4596492/608639), [boost library problem: cannot find -lboost_system ld returned 1 exit status](https://askubuntu.com/q/723216), [Cannot find -lboost_system](https://stackoverflow.com/q/49142478/608639), etc. – jww May 28 '18 at 20:09
  • 1
    @bartop I ran `find /usr/ | grep boost_system`, the only thing that came out is `/usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1`, so no. – ninnum May 29 '18 at 04:49
  • @jww thanks for the suggestion links, I'll check them right away. – ninnum May 29 '18 at 04:50
  • 1
    Okay, so I followed one of the links @jww gave to me. I ran `sudo apt-get install libboost-all-dev`. Then I checked if there are any changes using `find /usr/ | grep boost system`. It showed `libboost_system.a` in my `linux-gnu` folder. I compiled my project and it works. So thank you for helping me on this case. – ninnum May 29 '18 at 06:30

0 Answers0