正在尝试为 Windows 构建websocket++。
g++ -Wall -O2 -I/c/boost/boost_1_52_0//boost chat_server.o chat.o -o chat_server -L/c/boost/boost_1_52_0//stage/lib ../../libwebsocketpp.a /c/boost/boost_1_52_0//stage/lib/libboost_system-mgw46-mt-1_52.a c/boost/boost_1_52_0//stage/lib/libboost_date_time-mgw46-mt-1_52.a c/boost/boost_1_52_0//stage/lib/libboost_program_options-mgw46-mt-1_52.a c/boost/boost_1_52_0//stage/lib/libboost_thread-mgw46-mt-1_52.a /c/boost/boost_1_52_0//stage/lib/libboost_regex-mgw46-mt-1_52.a -lpthread -lws2_32 -lmswsock
chat_server.o:chat_server.cpp:(.text$_ZN5boost6detail17sp_counted_impl_pINS_6threadEE7disposeEv[boost::detail::sp_counted_impl_p<boost::thread>::dispose()]+0x14): undefined reference to `_imp___ZN5boost6threadD1Ev'
chat_server.o:chat_server.cpp:(.text$_ZN5boost14checked_deleteINS_6threadEEEvPT_[void boost::checked_delete<boost::thread>(boost::thread*)]+0x11): undefined reference to `_imp___ZN5boost6threadD1Ev'
chat_server.o:chat_server.cpp:(.text$_ZN11websocketpp4role6serverINS_8endpointIS1_NS_6socket5plainENS_3log6loggerEEEE12start_listenERKN5boost4asio2ip14basic_endpointINSB_3tcpEEEj[websocketpp::role::server<websocketpp::endpoint<websocketpp::role::server, websocketpp::socket::plain, websocketpp::log::logger> >::start_listen(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, unsigned int)]+0x307): undefined reference to `_imp___ZN5boost6thread12start_threadEv'
collect2: ld returned 1 exit status
make: *** [chat_server] Error 1
不要介意路径中的双斜杠,这是因为我草率地编辑 makefile。
我还必须使用 MinGW 编译 boost 1.52。
链接器似乎无法找到boost::thread
and boost::thread::start_thread
。