Visual Studio 2013 Boost-log v1_61_0链接错误 [英] Visual Studio 2013 Boost-log v1_61_0 linking errors

查看:1275
本文介绍了Visual Studio 2013 Boost-log v1_61_0链接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用简单的boost.asio daytime6教程文件,它工作得很好
并添加boost.log简单logger,取自settings_file示例
代码如下:

  // 
// server.cpp
// ~~~~~~~~~~
//
//版权所有(c)2003-2015 Christopher M. Kohlhoff(chris at kohlhoff dot com)
//
//根据Boost软件许可证版本1.0分发。 (见随附的
//文件LICENSE_1_0.txt或复制在http://www.boost.org/LICENSE_1_0.txt)
//

#include< ctime>
#include< iostream>
#include< string>
#include< exception>
#include< fstream>
#include< boost / array.hpp>
#include< boost / bind.hpp>
#include< boost / shared_ptr.hpp>
#include< boost / asio.hpp>
#include< boost / log / common.hpp>
#include< boost / log / attributes.hpp>
#include< boost / log / utility / setup / from_stream.hpp>

命名空间logging = boost :: log;
namespace attrs = boost :: log :: attributes;
namespace src = boost :: log :: sources;
using boost :: asio :: ip :: udp;
enum severity_level
{
normal,
notification,
warning,
error,
critical
};
BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(my_logger,SRC :: severity_logger<>)

标准::字符串make_daytime_string()使用命名空间std
{
; //对于time_t,时间和ctime;
time_t now = time(0);
return ctime(& now);
}

class udp_server
{
public:
udp_server(boost :: asio :: io_service& io_service)
:socket_(io_service ,udp :: endpoint(udp :: v4(),4221))
{
start_receive();
}

private:
void start_receive()
{
socket_.async_receive_from(
boost :: asio :: buffer(recv_buffer_) ,remote_endpoint_,
boost :: bind(& udp_server :: handle_receive,this,
boost :: asio :: placeholders :: error,
boost :: asio :: placeholders :: bytes_transferred ));
}

void handle_receive(const boost :: system :: error_code& error,
std :: size_t / * bytes_transferred * /)
{
if(!error || error == boost :: asio :: error :: message_size)
{
boost :: shared_ptr< std :: string> message(
new std :: string(make_daytime_string()));

socket_.async_send_to(提高:: ASIO ::缓冲区(*消息),remote_endpoint_,
的boost ::绑定(安培; udp_server :: handle_send,对此,消息,
boost :: asio :: placeholder :: error,
boost :: asio :: placeholders :: bytes_transferred));

start_receive();
}
}

void handle_send(boost :: shared_ptr< std :: string> / * message * /,
const boost :: system :: error_code& / * error * /,
std :: size_t / * bytes_transferred * /)
{
}

udp :: socket socket_;
udp :: endpoint remote_endpoint_;
boost :: array< char,1> recv_buffer_;
};

int main()
{

try
{
src :: severity_logger< >& lg = my_logger :: get();
BOOST_LOG_SEV(lg,normal)<< 这是正常的严重性记录;
std :: cout<< utp server started port:4221 \\\
<< std :: endl;
boost :: asio :: io_service io_service;
udp_server server(io_service);
io_service.run()
}
catch(std :: exception& e)
{
std :: cerr< e.what()< std :: endl;
}

return 0;
}

链接库是:

  libboost_iostreams-vc120-mt-sgd-1_61.lib; libboost_regex-vc120-mt-sgd-1_61.lib; libboost_system-vc120-mt-sgd-1_61.lib; libboost_thread -vc120-MT-SGD-1_61.lib; libboost_timer-VC120-MT-SGD-1_61.lib; libboost_date_time-VC120-MT-SGD-1_61.lib; libboost_filesystem-VC120-MT-SGD-1_61.lib; libboost_atomic-VC120 -mt-sgd-1_61.lib; libboost_log_setup-vc120-mt-sgd-1_61.lib;%(AdditionalDependencies)


$ b b

预处理器标志是:

  WIN32; _DEBUG; _CONSOLE; _LIB; _CRT_SECURE_NO_WARNINGS; _WIN32_WINNT = 0x0501; _CRT_SECURE_NO_DEPRECATE ;%(PreprocessorDefinitions)



Boost-log链接器错误

i检查是否设置为Yes(/ Zc:wchar_t ),而它。



但我仍然得到这些链接错误:

  1> net_udp_server .obj:error LNK2019:未解析的外部符号public:static void * __cdecl boost :: log :: v2s_mt_nt5 :: attribute :: impl :: operator new(unsigned int)(?? 2impl @ attribute @ v2s_mt_nt5 @ log @ boost @@ SAPAXI @ Z)的函数引用公众:__thiscall提振::登录:: v2s_mt_nt5 ::来源:: AUX :: severity_level< INT> :: severity_level< INT>(无效)?(?? 0 $ severity_level @ ^ h @ AUX @ @源@ v2s_mt_nt5登录@提振@@ QAE @ XZ)
1 GT; net_udp_server.obj:错误LNK2019:无法解析的外部符号市民:静态无效__cdecl的boost ::登录:: v2s_mt_nt5 ::属性: :IMPL :: delete操作符(无效*,无符号整型)的函数__unwindfunclet $?0 $ severity_level引用@ H一般@ AUX @源(?? 3impl @属性@ v2s_mt_nt5 @ @日志提振@@ SAXPAXI @ Z)@? v2s_mt_nt5 @ log @ boost @@ QAE @ XZ $ 0
1> net_udp_server.obj:error LNK2019:未解析的外部符号public:__thiscall boost :: log :: v2s_mt_nt5 :: attribute_set :: attribute_set(void)在函数public:__thiscall boost :: log :: v2s_mt_nt5 :: sources :: basic_logger< char,class boost :: log :: v2s_mt_nt5 :: sources ::中引用的参数:?0attribute_set @ v2s_mt_nt5 @ log @ boost @@ QAE @ XZ) severity_logger< int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model> :: basic_logger< char,class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>,struct boost :: log: :??v2s_mt_nt5 ::来源:: single_thread_model>(无效)(?? 0 $ @ basic_logger DV $ severity_logger @ H一般@ @源@ v2s_mt_nt5日志@提振@@ Usingle_thread_model @ 2345 @@源@ v2s_mt_nt5 @ @登录@提振@ QAE @ XZ)
1> net_udp_server.obj:error LNK2019:未解析的外部符号public:__thiscall boost :: log :: v2s_mt_nt5 :: attribute_set :: attribute_set(class boost :: log :: v2s_mt_nt5 :: attribute_set常量和放大器;)(?? 0attribute_set @ v2s_mt_nt5 @ @登录提振@@ QAE @ ABV0123 @@ Z)的函数引用公众:__thiscall提振::登录:: v2s_mt_nt5 ::来源:: basic_logger<焦炭,类boost: :log :: v2s_mt_nt5 :: sources :: severity_logger< int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model> :: basic_logger< char,class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< ; int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model>(class boost :: log :: v2s_mt_nt5 :: sources :: basic_logger< char,class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model> const&)(?? 0?$ basic_logger @ DV?$ severity_logger @ H @ sources @ v2s_mt_nt5 @ log @ boost @@ Usingle_thread_model @ 2345 @@ sources @ v2s_mt_nt5 @ log @ boost @@ QAE @ ABV01234 @@ Z)
1> net_udp_server.obj:error LNK2019:未解析的外部符号public:__thiscall boost :: log :: v2s_mt_nt5 :: attribute_set ::〜attribute_set(void)(?? 1attribute_set @ v2s_mt_nt5 @ log @ boost @@ QAE @ XZ)引用函数public:__thiscall boost :: log :: v2s_mt_nt5 :: sources :: basic_logger< char,class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model> ::〜basic_logger< char,class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model> (void)(?? 1?$ basic_logger @ DV?$ severity_logger @ H @ sources @ v2s_mt_nt5 @ log @ boost @@ Usingle_thread_model @ 2345 @@ sources @ v2s_mt_nt5 @ log @ boost @@ QAE @ XZ)
1> net_udp_server.obj:error LNK2019:未解析的外部符号public:struct std :: pair< class boost :: log :: v2s_mt_nt5 :: attribute_set :: iter< 0>,bool> __thiscall boost :: log :: v2s_mt_nt5 :: attribute_set :: insert(class boost :: log :: v2s_mt_nt5 :: attribute_name,class boost :: log :: v2s_mt_nt5 :: attribute const&)(?insert @ attribute_set @ v2s_mt_nt5 @ log @ boost @@ QAE?AU?$ pair @ V?$ iter @ $ 0A @@ attribute_set @ v2s_mt_nt5 @ log @ boost @@ _ N @ std @@ Vattribute_name @ 234 @ ABVattribute @ 234 @@ Z) public:class boost :: log :: v2s_mt_nt5 :: attribute& __thiscall boost :: log :: v2s_mt_nt5 :: aux :: attribute_set_reference_proxy :: operator =(class boost :: log :: v2s_mt_nt5 :: attribute const&)const(?? 4attribute_set_reference_proxy @ aux @ v2s_mt_nt5 @ log @ boost @@ QBEAAVattribute @ 234 @ ABV5234 @@ Z)
1> net_udp_server.obj:error LNK2019:未解析的外部符号public:static void __cdecl boost :: log :: v2s_mt_nt5 :: record_view :: public_data :: destroy在函数public:void __thiscall boost :: log ::中引用的:: log :: v2s_mt_nt5 :: record_view :: public_data const *)(?destroy @ public_data @ record_view @ v2s_mt_nt5 @ log @ boost @@ SAXPBU12345 @@ Z) v2s_mt_nt5 :: record :: reset(void)(?reset @ record @ v2s_mt_nt5 @ log @ boost @@ QAEXXZ)
1> net_udp_server.obj:error LNK2019:未解析的外部符号public:static class boost shared_ptr< class boost :: log :: v2s_mt_nt5 :: core> __cdecl boost :: log :: v2s_mt_nt5 :: core :: get(void)(?get @ core @ v2s_mt_nt5 @ log @ boost @@ SA?AV?$ shared_ptr @ Vcor​​e @ v2s_mt_nt5 @ log @ boost @ XZ)引用的函数public:__thiscall boost :: log :: v2s_mt_nt5 :: sources :: basic_logger< char,class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model> :: basic_logger< char,class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model> :: log :: v2s_mt_nt5 :: sources :: basic_logger< char,class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model> const& ;)(?? 0?$ basic_logger @ DV?$ severity_logger @ H @ sources @ v2s_mt_nt5 @ log @ boost @@ Usingle_thread_model @ 2345 @@ sources @ v2s_mt_nt5 @ log @ boost @@ QAE @ ABV01234 @@ Z)
1> net_udp_server.obj:error LNK2019:未解析的外部符号public:bool __thiscall boost :: log :: v2s_mt_nt5 :: core :: get_logging_enabled(void)const(?get_logging_enabled @ core @ v2s_mt_nt5 @ log @ boost @@ QBE_NXZ)在函数public:class boost :: log :: v2s_mt_nt5 :: record __thiscall boost :: log :: v2s_mt_nt5 :: sources :: basic_composite_logger< char,class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger& ; int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model,struct boost :: log :: v2s_mt_nt5 :: sources :: features< struct boost :: log :: v2s_mt_nt5 :: sources :: severity< int> ; > > :: open_record< struct boost :: parameter :: aux :: tagged_argument< struct boost :: log :: v2s_mt_nt5 :: keywords :: tag :: severity,enum severity_level const> >(struct boost :: parameter :: aux :: tagged_argument< struct boost :: log :: v2s_mt_nt5 :: keywords :: tag :: severity,enum severity_level const> const&)(?? $ open_record @ U ?$ tagged_argument @ Useverity @ tag @ keywords @ v2s_mt_nt5 @ log @ boost @@ $$ CBW4severity_level @@@ aux @ parameter @ boost @@@?$ basic_composite_logger @ DV?$ severity_logger @ H @ sources @ v2s_mt_nt5 @ log @ boost @ @ Usingle_thread_model @ 2345 @ U?$ features @ U?$ severity @ H @ sources @ v2s_mt_nt5 @ log @ boost @@@ 2345 @@ sources @ v2s_mt_nt5 @ log @ boost @@ QAE?AVrecord @ 234 @ ABU?$ tagged_argument @使用方法@ tag @ keywords @ v2s_mt_nt5 @ log @ boost @@ $$ CBW4severity_level @@@ aux @ parameter @ 4 @@ Z)
1> net_udp_server.obj:error LNK2019:未解析的外部符号public:class boost: :log :: v2s_mt_nt5 :: record __thiscall boost :: log :: v2s_mt_nt5 :: core :: open_record(class boost :: log :: v2s_mt_nt5 :: attribute_set const&)(?open_record @ core @ v2s_mt_nt5 @ log @ boost函数protected:class boost :: log :: v2s_mt_nt5 :: record __thiscall boost :: log :: v2s_mt_nt5 :: sources :: basic_logger< char,class中引用的@@@@@@QAE?AVrecord @ 234 @ ABVattribute_set @ boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model> :: open_record_unlocked< struct boost :: parameter :: aux :: tagged_argument< struct boost :: log :: v2s_mt_nt5 :: keywords :: tag :: severity,enum severity_level const> >(struct boost :: parameter :: aux :: tagged_argument< struct boost :: log :: v2s_mt_nt5 :: keywords :: tag :: severity,enum severity_level const> const&)(?? $ open_record_unlocked @ U ?$ tagged_argument @ Useverity @ tag @ keywords @ v2s_mt_nt5 @ log @ boost @@ $$ CBW4severity_level @@@ aux @ parameter @ boost @@@?$ basic_logger @ DV?$ severity_logger @ H @ sources @ v2s_mt_nt5 @ log @ boost @ @ Usingle_thread_model @ 2345 @@ sources @ v2s_mt_nt5 @ log @ boost @@ IAE?AVrecord @ 234 @ ABU?$ tagged_argument @ Useverity @ tag @ keywords @ v2s_mt_nt5 @ log @ boost @@ $$ CBW4severity_level @@@ aux @ parameter @ 4 @@ Z)
1> net_udp_server.obj:error LNK2019:未解析的外部符号private:void __thiscall boost :: log :: v2s_mt_nt5 :: core :: push_record_move(class boost :: log :: v2s_mt_nt5 :: record在函数public:void __thiscall boost :: log :: v2s_mt_nt5 :: core :: push_record(class boost :: string_ups)中引用的(&)(?push_record_move @ core @ v2s_mt_nt5 @ log @ boost @@ AAEXAAVrecord @ log :: v2s_mt_nt5 :: record&&)(?push_record @ core @ v2s_mt_nt5 @ log @ boost @@ QAEX $$ QAVrecord @ 234 @@ Z)
1> net_udp_server.obj:error LNK2019:unresolved外部符号public:void __thiscall boost :: log :: v2s_mt_nt5 :: aux :: once_block_sentry :: commit(void)(?commit @ once_block_sentry @ aux @ v2s_mt_nt5 @ log @ boost @@ QAEXXZ) static class boost :: shared_ptr< struct boost :: log :: v2s_mt_nt5 :: sources :: aux :: logger_holder< class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int> > > & __cdecl boost :: log :: v2s_mt_nt5 :: aux :: lazy_singleton< struct boost :: log :: v2s_mt_nt5 :: sources :: aux :: logger_singleton< struct my_logger>,class boost :: shared_ptr< struct boost :: log :: v2s_mt_nt5 :: sources :: aux :: logger_holder< class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int> > > > :: get(void)(?get @?$ lazy_singleton @ U?$ logger_singleton @ Umy_logger @@@ aux @ sources @ v2s_mt_nt5 @ log @ boost @@ V?$ shared_ptr @ U?$ logger_holder @ V?$ severity_logger @ H @ sources @ v2s_mt_nt5 @ log @ boost @@@ aux @ sources @ v2s_mt_nt5 @ log @ boost @@@ 6 @@ aux @ v2s_mt_nt5 @ log @ boost @@ SAAAV?$ shared_ptr @ U?$ logger_holder @ $ severity_logger @ H @ sources @ v2s_mt_nt5 @ log @ boost @@@ aux @ sources @ v2s_mt_nt5 @ log @ boost @@@ 5 @ XZ)
1> net_udp_server.obj:error LNK2019:未解析的外部符号private:在函数中引用的bool __thiscall boost :: log :: v2s_mt_nt5 :: aux :: once_block_sentry :: enter_once_block(void)const(?enter_once_block @ once_block_sentry @ aux @ v2s_mt_nt5 @ log @ boost @@ ABE_NXZ)public:bool __thiscall boost: :log :: v2s_mt_nt5 :: aux :: once_block_sentry :: executed(void)const(?executed @ once_block_sentry @ aux @ v2s_mt_nt5 @ log @ boost @@ QBE_NXZ)
1> net_udp_server.obj:error LNK2019:unresolved外部符号private:void __thiscall boost :: log :: v2s_mt_nt5 :: aux :: once_block_sentry :: rollback(void)(?rollback @ once_block_sentry @ aux @ v2s_mt_nt5 @ log @ boost @@ AAEXXZ) __thiscall boost :: log :: v2s_mt_nt5 :: aux :: once_block_sentry ::〜once_block_sentry(void)(?? 1once_block_sentry @ aux @ v2s_mt_nt5 @ log @ boost @@ QAE @ XZ)
1> net_udp_server.obj:错误LNK2019:未解析的外部符号public:static class boost :: shared_ptr< struct boost :: log :: v2s_mt_nt5 :: sources :: aux :: logger_holder_base> __cdecl boost :: log :: v2s_mt_nt5 :: sources :: aux :: global_storage :: get_or_init(class boost :: typeindex :: stl_type_index,class boost :: shared_ptr< struct boost :: log :: v2s_mt_nt5 :: sources :: aux :: logger_holder_base>(__cdecl *)(void))(?get_or_init @ global_storage @ aux @ sources @ v2s_mt_nt5 @ log @ boost @@ SA?AV?$ shared_ptr @ Ulogger_holder_base @ aux @ sources @ v2s_mt_nt5 @ log @ boost @@在函数public:static void __cdecl boost :: log :: v2s_mt_nt5 :: sources :: aux :: logger_singleton< struct my_logger> :: init_instance()中引用的@ 6 @ Vstl_type_index @ typeindex @ 6 @ P6A?AV76 @ XZ @ void)(?init_instance @?$ logger_singleton @ Umy_logger @@@ aux @ sources @ v2s_mt_nt5 @ log @ boost @@ SAXXZ)
1> net_udp_server.obj:error LNK2019:未解析的外部符号void __cdecl boost :: log :: v2s_mt_nt5 :: sources :: aux :: throw_odr_violation(class boost :: typeindex :: stl_type_index,class boost :: typeindex :: stl_type_index,struct boost :: log :: v2s_mt_nt5 :: sources :: aux :: logger_holder_base const在函数public:static void __cdecl boost :: log :: v2s_mt_nt5 ::中引用的(&)(?throw_odr_violation @ aux @ sources @ v2s_mt_nt5 @ log @ boost @@ YAXVstl_type_index @ typeindex @ 5 @ 0ABUlogger_holder_base @ 12345 @ sources :: aux :: logger_singleton< struct my_logger> :: init_instance(void)(?init_instance @?$ logger_singleton @ Umy_logger @@@ aux @ sources @ v2s_mt_nt5 @ log @ boost @@ SAXXZ)
1> net_udp_server .obj:error LNK2019:未解析的外部符号unsigned int __cdecl boost :: log :: v2s_mt_nt5 :: aux :: unhandled_exception_count(void)(?unhandled_exception_count @ aux @ v2s_mt_nt5 @ log @ boost @@ YAIXZ) :__thiscall boost :: log :: v2s_mt_nt5 :: aux :: record_pump< class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int> > :: record_pump< class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int> >(class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>&,class boost :: log :: v2s_mt_nt5 :: record&)(?? 0?$ record_pump @ V?$ severity_logger @ H @ sources @ v2s_mt_nt5 @ log @ boost @@@ aux @ v2s_mt_nt5 @ log @ boost @@ QAE @ AAV?$ severity_logger @ H @ sources @ 234 @ AAVrecord @ 234 @@ Z)
1> net_udp_server。 obj:error LNK2019:unresolved external symbolclass boost :: log :: v2s_mt_nt5 :: attribute_name __cdecl boost :: log :: v2s_mt_nt5 :: aux :: default_attribute_names :: severity(void)(?severity @ default_attribute_names @ aux @ v2s_mt_nt5在函数public:__thiscall中引用的@log @ boost @@ YA?AVattribute_name @ 345 @ XZ?boost :: log :: v2s_mt_nt5 :: sources :: basic_severity_logger< class boost :: log :: v2s_mt_nt5 :: sources :: basic_logger< char,class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model>,int> :: basic_severity_logger< class boost :: log :: v2s_mt_nt5 :: sources :: basic_logger< char,class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model>,int> log :: v2s_mt_nt5 :: sources :: basic_severity_logger< class boost :: log :: v2s_mt_nt5 :: sources :: basic_logger< char,class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>,struct boost :: log :: v2s_mt_nt5 :: sources :: single_thread_model>,int> const&)(?? 0?$ basic_severity_logger @ V?$ basic_logger @ DV?$ severity_logger @ H @ sources @ v2s_mt_nt5 @ log @ boost @@ Usingle_thread_model @ 2345 @@ sources @ v2s_mt_nt5 @ log @ boost @ source @ v2s_mt_nt5 @ log @ boost @@ QAE @ ABV01234 @@ Z)
1> net_udp_server.obj:error LNK2019:未解析的外部符号unsigned __int64& __cdecl boost :: log :: v2s_mt_nt5 :: sources :: aux :: get_severity_level(void)(?get_severity_level @ aux @ sources @ v2s_mt_nt5 @ log @ boost @@ YAAA_KXZ)在函数public:virtual class boost :: intrusive_ptr< ; struct boost :: log :: v2s_mt_nt5 :: attribute_value :: impl> __thiscall boost :: log :: v2s_mt_nt5 :: sources :: aux :: severity_level< int> :: impl :: detach_from_thread(void)(?detach_from_thread @ impl @?$ severity_level @ H @ aux @ sources @ v2s_mt_nt5 @ log @ boost @@ UAE?AV?$ intrusive_ptr @ Uimpl @ attribute_value @ v2s_mt_nt5 @ log @ boost @@@ 7 @ XZ)
1> net_udp_server.obj:error LNK2019:未解析的外部符号public:static struct boost log :: v2s_mt_nt5 :: aux :: stream_provider< char> :: stream_compound * __cdecl boost :: log :: v2s_mt_nt5 :: aux :: stream_provider< char> :: allocate_compound(class boost :: log :: v2s_mt_nt5 :: record& ;}在函数public:__thiscall boost :: log :: v2s_mt_nt5 :: aux中引用的(?allocate_compound @?$ stream_provider @ D @ aux @ v2s_mt_nt5 @ log @ boost @@ SAPAUstream_compound @ 12345 @ AAVrecord @ 345 @@ Z) :: record_pump< class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int> > :: record_pump< class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int> >(class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int>&,class boost :: log :: v2s_mt_nt5 :: record&)(?? 0?$ record_pump @ V?$ severity_logger @ H @ sources @ v2s_mt_nt5 @ log @ boost @@@ aux @ v2s_mt_nt5 @ log @ boost @@ QAE @ AAV?$ severity_logger @ H @ sources @ 234 @ AAVrecord @ 234 @@ Z)
1> net_udp_server。 obj:error LNK2019:未解析的外部符号public:static void __cdecl boost :: log :: v2s_mt_nt5 :: aux :: stream_provider< char> :: release_compound(struct boost :: log :: v2s_mt_nt5 :: aux :: stream_provider< char> ;}}引用在函数public:__thiscall boost :: log :: v2s_mt_nt5 :: aux中引用的@ stream @ boost @@ SAXPAUstream_compound @ 12345 @@ Z :: record_pump< class boost :: log :: v2s_mt_nt5 :: sources :: severity_logger< int> > :: auto_release ::〜auto_release(void)(?? 1auto_release @?$ record_pump @ V?$ severity_logger @ H @ sources @ v2s_mt_nt5 @ log @ boost @@@ aux @ v2s_mt_nt5 @ log @ boost @@ QAE @ XZ)
1> D:\dev\cpp\server\RakNet\RakNet\Debug\\\
et_udp_server.exe: c>


解决方案

我怀疑你的Boost是为Windows Vista和更高版本构建的, XP。因此Boost.Log符号在库二进制文件和您的对象文件中有不同的修改。



要构建Boost for Windows XP,您需要添加<$ c在构建Boost时,将$ c> define = BOOST_USE_WINAPI_VERSION = 0x0501 添加到 b2 命令行中,并且在构建代码时也类似地定义此宏。 / p>

I try to take the simple boost.asio daytime6 tutorial file , which workes great and add boost.log simple logger , taken from the settings_file example The code looks like this :

//
// server.cpp
// ~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#include <ctime>
#include <iostream>
#include <string>
#include <exception>
#include <fstream> 
#include <boost/array.hpp>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/asio.hpp>
#include <boost/log/common.hpp>
#include <boost/log/attributes.hpp>
#include <boost/log/utility/setup/from_stream.hpp>

namespace logging = boost::log;
namespace attrs = boost::log::attributes;
namespace src = boost::log::sources;
using boost::asio::ip::udp;
enum severity_level
{
    normal,
    notification,
    warning,
    error,
    critical
};
BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(my_logger, src::severity_logger< >)

std::string make_daytime_string()
{
    using namespace std; // For time_t, time and ctime;
    time_t now = time(0);
    return ctime(&now);
}

class udp_server
{
public:
    udp_server(boost::asio::io_service& io_service)
        : socket_(io_service, udp::endpoint(udp::v4(), 4221))
    {
        start_receive();
    }

private:
    void start_receive()
    {
        socket_.async_receive_from(
            boost::asio::buffer(recv_buffer_), remote_endpoint_,
            boost::bind(&udp_server::handle_receive, this,
            boost::asio::placeholders::error,
            boost::asio::placeholders::bytes_transferred));
    }

    void handle_receive(const boost::system::error_code& error,
        std::size_t /*bytes_transferred*/)
    {
        if (!error || error == boost::asio::error::message_size)
        {
            boost::shared_ptr<std::string> message(
                new std::string(make_daytime_string()));

            socket_.async_send_to(boost::asio::buffer(*message), remote_endpoint_,
                boost::bind(&udp_server::handle_send, this, message,
                boost::asio::placeholders::error,
                boost::asio::placeholders::bytes_transferred));

            start_receive();
        }
    }

    void handle_send(boost::shared_ptr<std::string> /*message*/,
        const boost::system::error_code& /*error*/,
        std::size_t /*bytes_transferred*/)
    {
    }

    udp::socket socket_;
    udp::endpoint remote_endpoint_;
    boost::array<char, 1> recv_buffer_;
};

int main()
{

    try
    {
        src::severity_logger< >& lg = my_logger::get();
        BOOST_LOG_SEV(lg, normal) << "This is a normal severity record";
        std::cout << "utp server started port:4221 \n" << std::endl;
        boost::asio::io_service io_service;
        udp_server server(io_service);
        io_service.run();
    }
    catch (std::exception& e)
    {
        std::cerr << e.what() << std::endl;
    }

    return 0;
}

The link libs are :

libboost_iostreams-vc120-mt-sgd-1_61.lib;libboost_regex-vc120-mt-sgd-1_61.lib;libboost_system-vc120-mt-sgd-1_61.lib;libboost_thread-vc120-mt-sgd-1_61.lib;libboost_timer-vc120-mt-sgd-1_61.lib;libboost_date_time-vc120-mt-sgd-1_61.lib;libboost_filesystem-vc120-mt-sgd-1_61.lib;libboost_atomic-vc120-mt-sgd-1_61.lib;libboost_log_setup-vc120-mt-sgd-1_61.lib;%(AdditionalDependencies)

the pre -processor flags are :

WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)

according to this thread :
Boost-log linker error
i did check if it set to Yes (/Zc:wchar_t) , and it does .

but i still getting those linking error's:

1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: static void * __cdecl boost::log::v2s_mt_nt5::attribute::impl::operator new(unsigned int)" (??2impl@attribute@v2s_mt_nt5@log@boost@@SAPAXI@Z) referenced in function "public: __thiscall boost::log::v2s_mt_nt5::sources::aux::severity_level<int>::severity_level<int>(void)" (??0?$severity_level@H@aux@sources@v2s_mt_nt5@log@boost@@QAE@XZ)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: static void __cdecl boost::log::v2s_mt_nt5::attribute::impl::operator delete(void *,unsigned int)" (??3impl@attribute@v2s_mt_nt5@log@boost@@SAXPAXI@Z) referenced in function __unwindfunclet$??0?$severity_level@H@aux@sources@v2s_mt_nt5@log@boost@@QAE@XZ$0
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::log::v2s_mt_nt5::attribute_set::attribute_set(void)" (??0attribute_set@v2s_mt_nt5@log@boost@@QAE@XZ) referenced in function "public: __thiscall boost::log::v2s_mt_nt5::sources::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model>::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model>(void)" (??0?$basic_logger@DV?$severity_logger@H@sources@v2s_mt_nt5@log@boost@@Usingle_thread_model@2345@@sources@v2s_mt_nt5@log@boost@@QAE@XZ)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::log::v2s_mt_nt5::attribute_set::attribute_set(class boost::log::v2s_mt_nt5::attribute_set const &)" (??0attribute_set@v2s_mt_nt5@log@boost@@QAE@ABV0123@@Z) referenced in function "public: __thiscall boost::log::v2s_mt_nt5::sources::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model>::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model>(class boost::log::v2s_mt_nt5::sources::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model> const &)" (??0?$basic_logger@DV?$severity_logger@H@sources@v2s_mt_nt5@log@boost@@Usingle_thread_model@2345@@sources@v2s_mt_nt5@log@boost@@QAE@ABV01234@@Z)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::log::v2s_mt_nt5::attribute_set::~attribute_set(void)" (??1attribute_set@v2s_mt_nt5@log@boost@@QAE@XZ) referenced in function "public: __thiscall boost::log::v2s_mt_nt5::sources::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model>::~basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model>(void)" (??1?$basic_logger@DV?$severity_logger@H@sources@v2s_mt_nt5@log@boost@@Usingle_thread_model@2345@@sources@v2s_mt_nt5@log@boost@@QAE@XZ)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: struct std::pair<class boost::log::v2s_mt_nt5::attribute_set::iter<0>,bool> __thiscall boost::log::v2s_mt_nt5::attribute_set::insert(class boost::log::v2s_mt_nt5::attribute_name,class boost::log::v2s_mt_nt5::attribute const &)" (?insert@attribute_set@v2s_mt_nt5@log@boost@@QAE?AU?$pair@V?$iter@$0A@@attribute_set@v2s_mt_nt5@log@boost@@_N@std@@Vattribute_name@234@ABVattribute@234@@Z) referenced in function "public: class boost::log::v2s_mt_nt5::attribute & __thiscall boost::log::v2s_mt_nt5::aux::attribute_set_reference_proxy::operator=(class boost::log::v2s_mt_nt5::attribute const &)const " (??4attribute_set_reference_proxy@aux@v2s_mt_nt5@log@boost@@QBEAAVattribute@234@ABV5234@@Z)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: static void __cdecl boost::log::v2s_mt_nt5::record_view::public_data::destroy(struct boost::log::v2s_mt_nt5::record_view::public_data const *)" (?destroy@public_data@record_view@v2s_mt_nt5@log@boost@@SAXPBU12345@@Z) referenced in function "public: void __thiscall boost::log::v2s_mt_nt5::record::reset(void)" (?reset@record@v2s_mt_nt5@log@boost@@QAEXXZ)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: static class boost::shared_ptr<class boost::log::v2s_mt_nt5::core> __cdecl boost::log::v2s_mt_nt5::core::get(void)" (?get@core@v2s_mt_nt5@log@boost@@SA?AV?$shared_ptr@Vcore@v2s_mt_nt5@log@boost@@@4@XZ) referenced in function "public: __thiscall boost::log::v2s_mt_nt5::sources::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model>::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model>(class boost::log::v2s_mt_nt5::sources::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model> const &)" (??0?$basic_logger@DV?$severity_logger@H@sources@v2s_mt_nt5@log@boost@@Usingle_thread_model@2345@@sources@v2s_mt_nt5@log@boost@@QAE@ABV01234@@Z)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: bool __thiscall boost::log::v2s_mt_nt5::core::get_logging_enabled(void)const " (?get_logging_enabled@core@v2s_mt_nt5@log@boost@@QBE_NXZ) referenced in function "public: class boost::log::v2s_mt_nt5::record __thiscall boost::log::v2s_mt_nt5::sources::basic_composite_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model,struct boost::log::v2s_mt_nt5::sources::features<struct boost::log::v2s_mt_nt5::sources::severity<int> > >::open_record<struct boost::parameter::aux::tagged_argument<struct boost::log::v2s_mt_nt5::keywords::tag::severity,enum severity_level const > >(struct boost::parameter::aux::tagged_argument<struct boost::log::v2s_mt_nt5::keywords::tag::severity,enum severity_level const > const &)" (??$open_record@U?$tagged_argument@Useverity@tag@keywords@v2s_mt_nt5@log@boost@@$$CBW4severity_level@@@aux@parameter@boost@@@?$basic_composite_logger@DV?$severity_logger@H@sources@v2s_mt_nt5@log@boost@@Usingle_thread_model@2345@U?$features@U?$severity@H@sources@v2s_mt_nt5@log@boost@@@2345@@sources@v2s_mt_nt5@log@boost@@QAE?AVrecord@234@ABU?$tagged_argument@Useverity@tag@keywords@v2s_mt_nt5@log@boost@@$$CBW4severity_level@@@aux@parameter@4@@Z)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: class boost::log::v2s_mt_nt5::record __thiscall boost::log::v2s_mt_nt5::core::open_record(class boost::log::v2s_mt_nt5::attribute_set const &)" (?open_record@core@v2s_mt_nt5@log@boost@@QAE?AVrecord@234@ABVattribute_set@234@@Z) referenced in function "protected: class boost::log::v2s_mt_nt5::record __thiscall boost::log::v2s_mt_nt5::sources::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model>::open_record_unlocked<struct boost::parameter::aux::tagged_argument<struct boost::log::v2s_mt_nt5::keywords::tag::severity,enum severity_level const > >(struct boost::parameter::aux::tagged_argument<struct boost::log::v2s_mt_nt5::keywords::tag::severity,enum severity_level const > const &)" (??$open_record_unlocked@U?$tagged_argument@Useverity@tag@keywords@v2s_mt_nt5@log@boost@@$$CBW4severity_level@@@aux@parameter@boost@@@?$basic_logger@DV?$severity_logger@H@sources@v2s_mt_nt5@log@boost@@Usingle_thread_model@2345@@sources@v2s_mt_nt5@log@boost@@IAE?AVrecord@234@ABU?$tagged_argument@Useverity@tag@keywords@v2s_mt_nt5@log@boost@@$$CBW4severity_level@@@aux@parameter@4@@Z)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "private: void __thiscall boost::log::v2s_mt_nt5::core::push_record_move(class boost::log::v2s_mt_nt5::record &)" (?push_record_move@core@v2s_mt_nt5@log@boost@@AAEXAAVrecord@234@@Z) referenced in function "public: void __thiscall boost::log::v2s_mt_nt5::core::push_record(class boost::log::v2s_mt_nt5::record &&)" (?push_record@core@v2s_mt_nt5@log@boost@@QAEX$$QAVrecord@234@@Z)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::log::v2s_mt_nt5::aux::once_block_sentry::commit(void)" (?commit@once_block_sentry@aux@v2s_mt_nt5@log@boost@@QAEXXZ) referenced in function "public: static class boost::shared_ptr<struct boost::log::v2s_mt_nt5::sources::aux::logger_holder<class boost::log::v2s_mt_nt5::sources::severity_logger<int> > > & __cdecl boost::log::v2s_mt_nt5::aux::lazy_singleton<struct boost::log::v2s_mt_nt5::sources::aux::logger_singleton<struct my_logger>,class boost::shared_ptr<struct boost::log::v2s_mt_nt5::sources::aux::logger_holder<class boost::log::v2s_mt_nt5::sources::severity_logger<int> > > >::get(void)" (?get@?$lazy_singleton@U?$logger_singleton@Umy_logger@@@aux@sources@v2s_mt_nt5@log@boost@@V?$shared_ptr@U?$logger_holder@V?$severity_logger@H@sources@v2s_mt_nt5@log@boost@@@aux@sources@v2s_mt_nt5@log@boost@@@6@@aux@v2s_mt_nt5@log@boost@@SAAAV?$shared_ptr@U?$logger_holder@V?$severity_logger@H@sources@v2s_mt_nt5@log@boost@@@aux@sources@v2s_mt_nt5@log@boost@@@5@XZ)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "private: bool __thiscall boost::log::v2s_mt_nt5::aux::once_block_sentry::enter_once_block(void)const " (?enter_once_block@once_block_sentry@aux@v2s_mt_nt5@log@boost@@ABE_NXZ) referenced in function "public: bool __thiscall boost::log::v2s_mt_nt5::aux::once_block_sentry::executed(void)const " (?executed@once_block_sentry@aux@v2s_mt_nt5@log@boost@@QBE_NXZ)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "private: void __thiscall boost::log::v2s_mt_nt5::aux::once_block_sentry::rollback(void)" (?rollback@once_block_sentry@aux@v2s_mt_nt5@log@boost@@AAEXXZ) referenced in function "public: __thiscall boost::log::v2s_mt_nt5::aux::once_block_sentry::~once_block_sentry(void)" (??1once_block_sentry@aux@v2s_mt_nt5@log@boost@@QAE@XZ)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: static class boost::shared_ptr<struct boost::log::v2s_mt_nt5::sources::aux::logger_holder_base> __cdecl boost::log::v2s_mt_nt5::sources::aux::global_storage::get_or_init(class boost::typeindex::stl_type_index,class boost::shared_ptr<struct boost::log::v2s_mt_nt5::sources::aux::logger_holder_base> (__cdecl*)(void))" (?get_or_init@global_storage@aux@sources@v2s_mt_nt5@log@boost@@SA?AV?$shared_ptr@Ulogger_holder_base@aux@sources@v2s_mt_nt5@log@boost@@@6@Vstl_type_index@typeindex@6@P6A?AV76@XZ@Z) referenced in function "public: static void __cdecl boost::log::v2s_mt_nt5::sources::aux::logger_singleton<struct my_logger>::init_instance(void)" (?init_instance@?$logger_singleton@Umy_logger@@@aux@sources@v2s_mt_nt5@log@boost@@SAXXZ)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "void __cdecl boost::log::v2s_mt_nt5::sources::aux::throw_odr_violation(class boost::typeindex::stl_type_index,class boost::typeindex::stl_type_index,struct boost::log::v2s_mt_nt5::sources::aux::logger_holder_base const &)" (?throw_odr_violation@aux@sources@v2s_mt_nt5@log@boost@@YAXVstl_type_index@typeindex@5@0ABUlogger_holder_base@12345@@Z) referenced in function "public: static void __cdecl boost::log::v2s_mt_nt5::sources::aux::logger_singleton<struct my_logger>::init_instance(void)" (?init_instance@?$logger_singleton@Umy_logger@@@aux@sources@v2s_mt_nt5@log@boost@@SAXXZ)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "unsigned int __cdecl boost::log::v2s_mt_nt5::aux::unhandled_exception_count(void)" (?unhandled_exception_count@aux@v2s_mt_nt5@log@boost@@YAIXZ) referenced in function "public: __thiscall boost::log::v2s_mt_nt5::aux::record_pump<class boost::log::v2s_mt_nt5::sources::severity_logger<int> >::record_pump<class boost::log::v2s_mt_nt5::sources::severity_logger<int> >(class boost::log::v2s_mt_nt5::sources::severity_logger<int> &,class boost::log::v2s_mt_nt5::record &)" (??0?$record_pump@V?$severity_logger@H@sources@v2s_mt_nt5@log@boost@@@aux@v2s_mt_nt5@log@boost@@QAE@AAV?$severity_logger@H@sources@234@AAVrecord@234@@Z)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "class boost::log::v2s_mt_nt5::attribute_name __cdecl boost::log::v2s_mt_nt5::aux::default_attribute_names::severity(void)" (?severity@default_attribute_names@aux@v2s_mt_nt5@log@boost@@YA?AVattribute_name@345@XZ) referenced in function "public: __thiscall boost::log::v2s_mt_nt5::sources::basic_severity_logger<class boost::log::v2s_mt_nt5::sources::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model>,int>::basic_severity_logger<class boost::log::v2s_mt_nt5::sources::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model>,int>(class boost::log::v2s_mt_nt5::sources::basic_severity_logger<class boost::log::v2s_mt_nt5::sources::basic_logger<char,class boost::log::v2s_mt_nt5::sources::severity_logger<int>,struct boost::log::v2s_mt_nt5::sources::single_thread_model>,int> const &)" (??0?$basic_severity_logger@V?$basic_logger@DV?$severity_logger@H@sources@v2s_mt_nt5@log@boost@@Usingle_thread_model@2345@@sources@v2s_mt_nt5@log@boost@@H@sources@v2s_mt_nt5@log@boost@@QAE@ABV01234@@Z)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "unsigned __int64 & __cdecl boost::log::v2s_mt_nt5::sources::aux::get_severity_level(void)" (?get_severity_level@aux@sources@v2s_mt_nt5@log@boost@@YAAA_KXZ) referenced in function "public: virtual class boost::intrusive_ptr<struct boost::log::v2s_mt_nt5::attribute_value::impl> __thiscall boost::log::v2s_mt_nt5::sources::aux::severity_level<int>::impl::detach_from_thread(void)" (?detach_from_thread@impl@?$severity_level@H@aux@sources@v2s_mt_nt5@log@boost@@UAE?AV?$intrusive_ptr@Uimpl@attribute_value@v2s_mt_nt5@log@boost@@@7@XZ)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: static struct boost::log::v2s_mt_nt5::aux::stream_provider<char>::stream_compound * __cdecl boost::log::v2s_mt_nt5::aux::stream_provider<char>::allocate_compound(class boost::log::v2s_mt_nt5::record &)" (?allocate_compound@?$stream_provider@D@aux@v2s_mt_nt5@log@boost@@SAPAUstream_compound@12345@AAVrecord@345@@Z) referenced in function "public: __thiscall boost::log::v2s_mt_nt5::aux::record_pump<class boost::log::v2s_mt_nt5::sources::severity_logger<int> >::record_pump<class boost::log::v2s_mt_nt5::sources::severity_logger<int> >(class boost::log::v2s_mt_nt5::sources::severity_logger<int> &,class boost::log::v2s_mt_nt5::record &)" (??0?$record_pump@V?$severity_logger@H@sources@v2s_mt_nt5@log@boost@@@aux@v2s_mt_nt5@log@boost@@QAE@AAV?$severity_logger@H@sources@234@AAVrecord@234@@Z)
1>net_udp_server.obj : error LNK2019: unresolved external symbol "public: static void __cdecl boost::log::v2s_mt_nt5::aux::stream_provider<char>::release_compound(struct boost::log::v2s_mt_nt5::aux::stream_provider<char>::stream_compound *)" (?release_compound@?$stream_provider@D@aux@v2s_mt_nt5@log@boost@@SAXPAUstream_compound@12345@@Z) referenced in function "public: __thiscall boost::log::v2s_mt_nt5::aux::record_pump<class boost::log::v2s_mt_nt5::sources::severity_logger<int> >::auto_release::~auto_release(void)" (??1auto_release@?$record_pump@V?$severity_logger@H@sources@v2s_mt_nt5@log@boost@@@aux@v2s_mt_nt5@log@boost@@QAE@XZ)
1>D:\dev\cpp\server\RakNet\RakNet\Debug\net_udp_server.exe : fatal error LNK1120: 21 unresolved externals

解决方案

I suspect your Boost was built for Windows Vista and later while you're building your code for Windows XP. As a result Boost.Log symbols are mangled differently in the library binaries and your object files.

To build Boost for Windows XP that you need to add define=BOOST_USE_WINAPI_VERSION=0x0501 to the b2 command line when building Boost and also define this macro similarly when building your code as well.

这篇关于Visual Studio 2013 Boost-log v1_61_0链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆