ACE_STUDY ACE应用程序链接错误 error LNK2019 的解决办法

简介:

ACE应用程序链接错误      error LNK2019 的解决办法 
注意:是Stone Jiang写的,我找到的文章。感谢他的文章!

读者水平:初级 http://blog.csdn.net/FocusOnACE/archive/2006/07/09/896332.aspx
摘要:文本简要指出如何正确编译和链接ACE应用程序。

对于新手来说,ACE开发环境,会是一团谜团,如何正确配置开发者机器,快速体验ACE,
就是本系列文章的目的。本文仅解决如何解决LNK2019错误

环境:
  

        ACE版本 5.5.1
         操作系统 Windows xp professional sp2
         开发环境 Microsoft Visual C++ 2005       77626-009-0000007-41235


下面的代码是服务的主程序

//  @file: RegisterServer.cpp :
//  @description: Defines the entry point for the GameService Daemon application.
//  @date: 2006-07-06
//  @author: Jiangtao<2005119@gmail.com>
#ifdef _DEBUG
#define        ACE_NDEBUG 0
#define        ACE_NTRACE 0
#endif
#include      " stdafx.h "
#include      " ACE/Filecache.h "
#include      " ACE/Log_Msg.h "
#include      " ACE/OS_NS_signal.h "
#include      " ACE/Service_Config.h "

#ifdef ACE_HAS_SIG_C_FUNC
#pragma message ( " ACE_HAS_SIG_C_FUNC " )
extern       " C "
{
#endif      /* ACE_HAS_SIG_C_FUNC */

       //       call exit() so that static destructors get called
       static        void
      handler (  int )
{
      delete (ACE_Filecache      * ) ACE_Filecache::instance ();
      ACE_OS::exit ( 0 );
}

#ifdef ACE_HAS_SIG_C_FUNC
}
#endif      /* ACE_HAS_SIG_C_FUNC */

int      ACE_TMAIN(  int      argc, ACE_TCHAR *      argv[])
{
ACE_DEBUG((LM_INFO,ACE_TEXT( " 启动服务\n " )));
ACE_Service_Config daemon;

ACE_OS::signal (SIGCHLD, SIG_IGN);

       //       SigAction not needed since the handler will shutdown the server.
ACE_OS::signal (SIGINT, (ACE_SignalHandler) handler);
ACE_OS::signal (SIGUSR2, (ACE_SignalHandler) handler);

       if      (daemon.open (argc, argv, ACE_DEFAULT_LOGGER_KEY,      0 )      !=       0 )
      ACE_ERROR_RETURN ((LM_ERROR,      " %p\n " ,      " open " ),      1 );

       //       The configured service creates threads, and the
      
//       server won't exit until the threads die.

      
//       Run forever, performing the configured services until we receive
      
//       a SIGINT.

       return       0 ;
}



服务加载的配置文件

###############################################################################
# file svc.conf
###############################################################################

dynamic GameService Service_Object      *      GameService: _make_GameServer_T() active


出错提示:

----- Build started: Project: RegisterServer, Configuration: Debug Win32 ------
Compiling
RegisterServer.cpp
Linking
RegisterServer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl ace_os_wmain_i(class ACE_Main_Base &,int,wchar_t * * const)" (
__imp_?ace_os_wmain_i@@YAHAAVACE_Main_Base@@HQAPA_W@Z) referenced in function _wmain
RegisterServer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static int __cdecl ACE_Service_Config::open(int,wchar_t * * const,wchar_t const *,int,int,int)" (
__imp_?open@ACE_Service_Config@@SAHHQAPA_WPB_WHHH@Z) referenced in function "int __cdecl ace_wmain_i(int,wchar_t * * const)" (?ace_wmain_i@@YAHHQAPA_W@Z)
D:\ACE_OUTPUT\Game\\RegisterServerd.exe : fatal error LNK1120: 2 unresolved externals
Build log was saved at "
file://d:\My Sources\RegisterService\RegisterServer\Debug\BuildLog.htm"
RegisterServer - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ========== 
问题分析
出错信息显示,不能解析函数ace_os_wmain_i()以及      ACE_Service_Config::open()。
从这里可以看出,链接器需要UNICODE版本的ace库,而我们在生成ACE的时候,并没有生成宽字符
的UNICODE版本。

解决办法:
打开项目的属性页,找到配置属性,在字符集中,选择多字节字符集。再重新编译,问题解决。
目录
相关文章
关于 编译软件时报错“xdo.c:29:34: fatal error: X11/extensions/XTest.h:”错误 的解决方法
关于 编译软件时报错“xdo.c:29:34: fatal error: X11/extensions/XTest.h:”错误 的解决方法
关于 编译软件时报错“xdo.c:29:34: fatal error: X11/extensions/XTest.h:”错误 的解决方法
|
移动开发 iOS开发
IOS开发错误library not found for -lXXX
IOS开发错误library not found for -lXXX
1009 0
IOS开发错误library not found for -lXXX
|
Linux 计算机视觉
关于 编译qt项目时报错:error: cannot find -lGLESv2 的解决方法
关于 编译qt项目时报错:error: cannot find -lGLESv2 的解决方法
|
计算机视觉
关于 编译QT项目时报错: error: cannot find -lGL 的解决方法
关于 编译QT项目时报错: error: cannot find -lGL 的解决方法
|
Python
Python基础-常见问题:访问文件时,提示“PermissionError: [WinError 5] 拒绝访问。: ‘test.txt‘”,怎么办呢?
Python基础-常见问题:访问文件时,提示“PermissionError: [WinError 5] 拒绝访问。: ‘test.txt‘”,怎么办呢?
697 0
|
C++ Windows
【错误记录】Windows 控制台程序编译报错 ( fatal error C1083: 无法打开包括文件: “afxwin.h”: No such file or directory )
【错误记录】Windows 控制台程序编译报错 ( fatal error C1083: 无法打开包括文件: “afxwin.h”: No such file or directory )
1111 0
【错误记录】Windows 控制台程序编译报错 ( fatal error C1083: 无法打开包括文件: “afxwin.h”: No such file or directory )
|
编译器 开发工具 Windows
Qt使用过程中,遇到error及解决方法总结
Qt使用过程中,遇到error及解决方法总结
|
IDE 开发工具 C++
Visual Studio下程序开发: error LNK2019: 无法解析的外部符号
Visual Studio下程序开发: error LNK2019: 无法解析的外部符号
870 0
Visual Studio下程序开发: error LNK2019: 无法解析的外部符号
|
IDE 开发工具
Visual Studio下程序开发: 引用库出现 error LNK2026: 模块对于 SAFESEH 映像是不安全的。
Visual Studio下程序开发: 引用库出现 error LNK2026: 模块对于 SAFESEH 映像是不安全的。
109 0
Visual Studio下程序开发: 引用库出现 error LNK2026: 模块对于 SAFESEH 映像是不安全的。
|
Windows
Qt Creator编译项目,报错,error: LNK1158: 无法运行“rc.exe”
Qt Creator编译项目,报错,error: LNK1158: 无法运行“rc.exe”
754 0