[英]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.我已经使用自制软件安装了 boost 并且在我按照一些步骤尝试让 gdb 调试器工作之前它正在工作,但是现在在我按照这些步骤重新启动后,我什至无法编译我的程序。 I have googled all over the place for the last 2 hours and I cannot figure this out.
在过去的 2 个小时里,我在整个地方用谷歌搜索,但我无法弄清楚这一点。
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.我试过卸载并重新安装 boost 以及我可以在 google 或 stackoverflow 上找到的任何其他东西,但没有任何效果,我明天晚上有任务要交,我吓坏了。
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
You need to ensure the boost include path is passed into your compiler.您需要确保将 boost 包含路径传递到您的编译器中。
The boost lib path will need to be passed into to your linker.需要将 boost lib 路径传递给您的链接器。
Depending on your environment, you can do this with the system path variable, Visual Studio properties, or as compiler/linker flags.根据您的环境,您可以使用系统路径变量、Visual Studio 属性或作为编译器/链接器标志来执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.