Jordan Ward
Jordan Ward

Reputation: 91

How to fix "fatal error: boost/asio.hpp: no such file or directory"?

I have installed boost using homebrew and it was working before I followed some steps to try and get gdb debugger working but now after I followed the steps and restarted, I can't even compile my program. I have googled all over the place for the last 2 hours and I cannot figure this out.

I have tried uninstalling and reinstalling boost and anything else that I could find on google or stackoverflow but nothing is working and I have an assignment due tomorrow night and I am freaking out.

Exact error:

fatal error: boost/asio.hpp: No such file or directory
 #include <boost/asio.hpp>
          ^~~~~~~~~~~~~~~~
compilation terminated.

I have tried compiling a number of ways including:

g++ -g -I /usr/local/Cellar/boost/1.69.0 battleship_client.cc -lboost_system

Upvotes: 2

Views: 20405

Answers (1)

James
James

Reputation: 300

You need to ensure the boost include path is passed into your compiler.

The boost lib path will need to be passed into to your linker.

Depending on your environment, you can do this with the system path variable, Visual Studio properties, or as compiler/linker flags.

Upvotes: 1

Related Questions