当使用boost :: asio LNK 2001(发布)时

时间:2013-12-20 11:15:29

标签: c++ visual-studio-2012 boost boost-asio

我正在开发聊天服务器(名称是PengChat),它是主要的源代码。

CServerSocket.h包括boost/asio.hpp),并且有两个错误。

1>main.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>main.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)

我的环境是

  • 操作系统 - Windows 8 Pro K(我是韩国人)
  • IDE - Visual Studio 2012
  • 属性→代码生成器→运行时库 - 多线程(/MT)(在发布中)

你知道这些错误吗?

请帮帮我。

感谢。

PS。在调试模式下(使用/MTd选项)。它汇编得很好。但在发布模式下(使用/MT选项),有两个错误。

PS2。我不能用 Ctrl + K ,这很奇怪;请看评论窗口

编辑

申请的源代码如下:

#include <stdio.h>
#include <memory>
#include "../PengChatServerLib/CServerSocket.h"

#ifdef _MSC_VER
    #ifdef _DEBUG
        #pragma comment(lib, "../Debug/PengChatServerLib") 
    #else
        #pragma comment(lib, "../Release/PengChatServerLib")
    #endif
#endif

int main()
{
    boost::asio::io_service iosrv;

    std::unique_ptr<PengChat::CServerSocket> pSock(new PengChat::CServerSocket(iosrv, 8888)); 

    getchar();

    pSock.reset();

    return 0;
} 

0 个答案:

没有答案