问题一: 64位和 32位 设置 导致的错误
运行时候,出现以下错误提示。
1> severUDP.cpp
1> Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
1> - add -D_WIN32_WINNT=0x0501 to the compiler command line; or
1> - add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.
1> Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
1>severUDP.obj : error LNK2019: 无法解析的外部符号 "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ),该符号在函数 "public: __thiscall boost::system::error_code::error_code(void)" (??0error_code@system@boost@@QAE@XZ) 中被引用
1>severUDP.obj : error LNK2019: 无法解析的外部符号 "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ),该符号在函数 "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??__Eposix_category@system@boost@@YAXXZ) 中被引用
解决方法:
方法一: 添加32位的库,对应 WIN32平台。
方法二: 设置运行图中的 X64平台,对应64位的库。
提示:同时添加64位和32位库,前面的会覆盖后面的库(没顾得上解决)
1> Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
1> - add -D_WIN32_WINNT=0x0501 to the compiler command line; or
1> - add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.
1> Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
错误中的 这个提示,在上述设置后,可以忽略。
网上有人说,需要以下设置
在头部加入
#ifdef _MSC_VER
#define _WIN32_WINNT 0x0501
#endif
没用上