【发布时间】:2021-06-18 09:26:55
【问题描述】:
您好,我正在尝试从 boost C++ 构建一个demo example 构建时出现以下错误
g++.exe -Wall -fexceptions -std=c++11 -g -IC:\boost -c C:\api\api\main.cpp -o obj\Debug\main.o g++.exe -LC:\boost\stage\lib -o bin\Debug\api.exe obj\Debug\main.o C:\boost\stage\lib\libboost_system-vc142-mt-gd-x64-1_75.lib C:\boost\stage\lib\libboost_filesystem-vc142-mt-gd-x64-1_75.lib obj\Debug\main.o:在函数
main': C:/api/api/main.cpp:31: undefined reference toboost::filesystem::path::make_preferred()' C:/api/api/main.cpp:34: 未定义的引用boost::filesystem::path::begin() const' C:/api/api/main.cpp:34: undefined reference toboost::filesystem::path::end() const'
根据我在互联网上找到的内容判断:this、this 和 this 我需要使用 C++11 支持重建 boost,并通过明确指定标准来构建我的项目。
我通过运行再次构建了 boost:
C:\boost>b2.exe 工具集=gcc cxxflags="-std=c++11"
在构建我的项目时,我会添加一个键
-std=c++11
但是我得到了所有相同的错误,并且来自互联网的提示对我不起作用,告诉我如何克服这个问题?
【问题讨论】: