使用TAO错误小结

在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

       暂时写这么多吧,呵呵,因为我刚刚接触,只是记录自己在使用过程中的错误,避免重犯,同时,也提醒别人使用过程注意的问题.:)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
static __time64_t __cdecl _make__time64_t ( struct tm *tb, int ultflag ) { __time64_t tmptm1, tmptm2, tmptm3; struct tm tbtemp; long dstbias = 0; long timezone = 0; _VALIDATE_RETURN( ( tb != NULL ), EINVAL, ( ( __time64_t )( -1 ) ) ) /* * First, make sure tm_year is reasonably close to being in range. */ if ( ((tmptm1 = tb->tm_year) < _BASE_YEAR - 1) || (tmptm1 > _MAX_YEAR64 + 1) ) goto err_mktime; /* * Adjust month value so it is in the range 0 - 11. This is because * we don't know how many days are in months 12, 13, 14, etc. */ if ( (tb->tm_mon < 0) || (tb->tm_mon > 11) ) { tmptm1 += (tb->tm_mon / 12); if ( (tb->tm_mon %= 12) < 0 ) { tb->tm_mon += 12; tmptm1--; } /* * Make sure year count is still in range. */ if ( (tmptm1 < _BASE_YEAR - 1) || (tmptm1 > _MAX_YEAR64 + 1) ) goto err_mktime; } /***** HERE: tmptm1 holds number of elapsed years *****/ /* * Calculate days elapsed minus one, in the given year, to the given * month. Check for leap year and adjust if necessary. */ tmptm2 = _days[tb->tm_mon]; if ( _IS_LEAP_YEAR(tmptm1) && (tb->tm_mon > 1) ) tmptm2++; /* * Calculate elapsed days since base date (midnight, 1/1/70, UTC) * * * 365 days for each elapsed year since 1970, plus one more day for * each elapsed leap year. no danger of overflow because of the range * check (above) on tmptm1. */ tmptm3 = (tmptm1 - _BASE_YEAR) * 365 + _ELAPSED_LEAP_YEARS(tmptm1); /* * elapsed days to current month (still no possible overflow) */ tmptm3 += tmptm2; /* * elapsed days to current date. */ tmptm1 = tmptm3 + (tmptm2 = (__time64_t)(tb->tm_mday)); /***** HERE: tmptm1 holds number of elapsed days *****/ /* * Calculate elapsed hours since base date */ tmptm2 = tmptm1 * 24; tmptm1 = tmptm2 + (tmptm3 = (__time64_t)tb->tm_hour); /***** HERE: tmptm1 holds number of elapsed hours *****/ /* * Calculate elapsed minutes since base date */ tmptm2 = tmptm1 * 60; tmptm1 = tmptm2 + (tmptm3 = (__time64_t)tb->tm_min); /***** HERE: tmptm1 holds number of elapsed minutes *****/ /* * Calculate elapsed seconds since base date */ tmptm2 = tmptm1 * 60; tmptm1 = tmptm2 + (tmptm3 = (__time64_t)tb->tm_sec); /***** HERE: tmptm1 holds number of elapsed seconds *****/ if ( ultflag ) { /* * Adjust for timezone. No need to check for overflow since * localtime() will check its arg value */ __tzset(); _ERRCHECK(_get_dstbias(&dstbias;)); _ERRCHECK(_get_timezone(&timezone;)); tmptm1 += timezone; /* * Convert this second count back into a time block structure. * If localtime returns NULL, return an error. */ if ( _localtime64_s(&tbtemp;, &tmptm1;) != 0 ) goto err_mktime; /* * Now must compensate for DST. The ANSI rules are to use the * passed-in tm_isdst flag if it is non-negative. Otherwise, * compute if DST applies. Recall that tbtemp has the time without * DST compensation, but has set tm_isdst correctly. */ if ( (tb->tm_isdst > 0) || ((tb->tm_isdst < 0) && (tbtemp.tm_isdst > 0)) ) { tmptm1 += dstbias; if ( _localtime64_s(&tbtemp;, &tmptm1;) != 0 ) goto err_mktime; } } else { if ( _gmtime64_s(&tbtemp;, &tmptm1;) != 0) goto err_mktime; } /***** HERE: tmptm1 holds number of elapsed seconds, adjusted *****/ /***** for local time if requested *****/ *tb = tbtemp; return tmptm1; err_mktime: /* * All errors come to here */ errno = EINVAL; return (__time64_t)(-1); }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值