我想知道是否可以编译此处找到的boost聊天客户端示例(带有3个文件的示例:chat_message.hpp,chat_client.cpp和chat_server.cpp):
http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/examples.html
使用VS 2008编译器?它汇编了2012年,但不是2008年或2010年。我使用的是升级版本1_51
我正在从VS 2012中编译它,但使用VS 2008的平台工具集。当我将编译器更改为2008时,突然命名空间行(在chat_client.cpp中)通过intellisense以红色加下划线:< / p>
using boost::asio::ip::tcp;
我无法弄清楚导致2008编译器失败的原因是什么,以及是否有某种方法可以解决这个问题(可能使用旧版本的boost?)。
这是我用2008编译时得到的输出(使用#define BOOST_LIB_DIAGNOSTIC):
1> Linking to lib file: libboost_system-vc90-mt-1_51.lib
1> Linking to lib file: libboost_date_time-vc90-mt-1_51.lib
1> Linking to lib file: libboost_regex-vc90-mt-1_51.lib
1> Linking to lib file: libboost_thread-vc90-mt-1_51.lib
1> Linking to lib file: libboost_chrono-vc90-mt-1_51.lib
1>c:\users\dustin\documents\boostexamples\boostchatclientexample\chat_message.hpp(70): warning C4996: 'strncat': This function or variable may be unsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(144) : see declaration of 'strncat'
1>c:\users\dustin\documents\boostexamples\boostchatclientexample\chat_message.hpp(84): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(366) : see declaration of 'sprintf'
1>chat_client.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ)
1>chat_client.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ)
1>chat_client.obj : error LNK2001: unresolved external symbol "public: void __thiscall boost::thread::detach(void)" (?detach@thread@boost@@QAEXXZ)
1>chat_client.obj : error LNK2001: unresolved external symbol "public: void __thiscall boost::thread::join(void)" (?join@thread@boost@@QAEXXZ)
1>chat_client.obj : error LNK2001: unresolved external symbol "private: void __thiscall boost::thread::start_thread(void)" (?start_thread@thread@boost@@AAEXXZ)
1>C:\Users\dustin\Documents\BoostExamples\BoostChatClientExample\Release\BoostChatClientExample.exe : fatal error LNK1120: 5 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========