在TAO的使用过程中,遇到的最多的是LINK 2001错误,下面举例说明:
1,类型错误
错误形式:strseqC.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall TAO::TypeCode::Sequence<class CORBA::TypeCode * const *,class strseqC.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class CORBA::TypeCode * CORBA::_tc_string" (__imp_?_tc_string@CORBA@@3QAVTypeCode@1@A)
strseqC.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall TAO::TypeCode::Alias<char const *,class CORBA::TypeCode * const *,class TAO::Null_RefCount_Policy>::Alias<char const *,class CORBA::TypeCode * const *,
class TAO::Null_RefCount_Policy>(enum CORBA::TCKind,char const *,char const *,class CORBA::TypeCode * const *)" (__imp_??0?$Alias@PBDPBQAVTypeCode@CORBA@@VNull_RefCount_Policy@TAO@@@TypeCode@TAO@@QAE@W4TCKind@CORBA@@PBD1PBQAV14@@Z)
.......
解决办法:包含TAO_AnyTypeCoded.lib
2,重载错误
错误:"error LNK2001: unresolved external symbol "int __cdecl ace_main_i(int,char * * const)" (?ace_main_i@@YAHHQAPAD@Z)"
原因:ACE中重载了MAIN函数
解决办法:首先,先确定LIB是否包含了,位置是否正确.添加参数int argc, char **argv,即main(int argc, char **argv).
3,错误:“ You must link against multi-threaded libraries when using ACE (check your project settings)”
解决办法:工程-设置-C/C++: Code Generation - Use run-time library : Debug Multithreaded Dll或Multithreaded Dll
4, 错误: “error LNK2001: unresolved external symbol "__declspec(dllimport) int __cdecl”
解决办法:工程-设置-Link-Input: 对象/库模块:添加aced.lib
附加库路径:D:/ACE_wrappers/ace
5,编译client中遇到的问题
(1)、error C2039: 'sprintf' : is not a member of 'ACE_OS'
解决办法: #include "ace/OS_NS_stdio.h"
(2)、error C2039: 'strlen' : is not a member of 'ACE_OS'
解决办法: #include "ace/OS_NS_string.h"
6,错误:ace_wrappers/ace/time_value.h(267) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
处理方法: 添加的头文件#include "orbsvcs/CosNamingC.h"放到所有头文件的最上面,且在"stdafx.h"的下面即可
7,'TryEnterCriticalSection' : is not a member of '`global namespace''
处理办法:在stdafx.h中增加如下宏定义,即可。
用于指明WINDOWS系统版本。
//for use TryEnterCriticalSection
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x500
#endif
暂时写这么多吧,呵呵,因为我刚刚接触,只是记录自己在使用过程中的错误,避免重犯,同时,也提醒别人使用过程注意的问题.:)