C++ 未定义的引用;boost::system::system_category();
上面是我在将C++ 未定义的引用;boost::system::system_category();,c++,boost,codeblocks,undefined-reference,C++,Boost,Codeblocks,Undefined Reference,上面是我在将boost/filesystem.hpp包含到我的项目中之后的完整错误消息。我看到一些帖子说添加-lboost\u系统可能会解决这个问题,但我不知道在代码块中应该在哪里做 我已经花了一天时间来解决这个问题。谢谢你的帮助 右键单击项目名称;单击“构建选项…”;转到“链接器设置”;点击“添加”;找到库并添加它 此外,您可以添加一些自定义变量,以简化调试/发布和32/64位目标选项的管理。我把这个留给你 编辑 以下是错误代码.hpp中的错误代码: obj\Debug\src\SQLi
boost/filesystem.hpp
包含到我的项目中之后的完整错误消息。我看到一些帖子说添加-lboost\u系统
可能会解决这个问题,但我不知道在代码块中应该在哪里做我已经花了一天时间来解决这个问题。谢谢你的帮助 右键单击项目名称;单击“构建选项…”;转到“链接器设置”;点击“添加”;找到库并添加它 此外,您可以添加一些自定义变量,以简化调试/发布和32/64位目标选项的管理。我把这个留给你
编辑 以下是
错误代码.hpp
中的错误代码:
obj\Debug\src\SQLite3DB.o||In function _static_initialization_and_destruction_0:|
D:\workspace-cpp\boost_1_54_0_beta1\boost\system\error_code.hpp|222|undefined reference to boost::system::generic_category()|
D:\workspace-cpp\boost_1_54_0_beta1\boost\system\error_code.hpp|223|undefined reference to boost::system::generic_category()|
D:\workspace-cpp\boost_1_54_0_beta1\boost\system\error_code.hpp|224|undefined reference to boost::system::system_category()|
||=== Build finished: 3 errors, 0 warnings (0 minutes, 4 seconds) ===|
如您所见,定义BOOST\u SYSTEM\u NO\u DEPRECATED
将禁用它。我已经测试过了,它是有效的。这包括:
# ifndef BOOST_SYSTEM_NO_DEPRECATED
inline const error_category & get_system_category() { return system_category(); }
inline const error_category & get_generic_category() { return generic_category(); }
inline const error_category & get_posix_category() { return generic_category(); }
static const error_category & posix_category = generic_category();
static const error_category & errno_ecat = generic_category();
static const error_category & native_ecat = system_category();
# endif
\define BOOST\u SYSTEM\u NO\u已弃用
#包括
内部主(空)
{
}
我刚刚在链接器中添加了-lboost\u系统,但出现了这个错误“没有这样的文件或口述”。我该怎么办?.\\\\..\Boost\1\u 54\u 0\VC\11.0\bin.v2\libs\system\build\msvc-11.0\debug\link static\threading multi\libboost\u system-vc110-mt-gd-1\u 54.lib——在我将其添加到链接器设置后,仍然会出现相同的错误!
#define BOOST_SYSTEM_NO_DEPRECATED
#include <boost/system/error_code.hpp>
int main(void)
{
}