vc6.0移植vs2005问题及解决方案汇总

Project upgrade from VC6 to VC8

1.        The visibility of various in for loop.

< id="TextBox1" classid="CLSID:8BD21D10-EC42-11CE-9E0D-00AA006002F3" width="289" height="104" id="TextBox1" classid="CLSID:8BD21D10-EC42-11CE-9E0D-00AA006002F3" width="289" height="104">

2.        The default length of time_t is 64bit, so please use macro _USE_32BIT_TIME_T for our project.

3.        Some macros of MFC message map are modified, just take this as a note. There will be compile errors where you meet this problem.

4.        Please use /MTd option and add msvcrtd.lib for some projects. Actually, I forget what this is for. If you get problem in dgbheap.c in a destructor of a class, please use /MDd option.

5.        Use the return value of erase function.

< id="TextBox2" classid="CLSID:8BD21D10-EC42-11CE-9E0D-00AA006002F3" width="529" height="137" id="TextBox2" classid="CLSID:8BD21D10-EC42-11CE-9E0D-00AA006002F3" width="529" height="137">

< id="TextBox5" classid="CLSID:8BD21D10-EC42-11CE-9E0D-00AA006002F3" width="529" height="140" id="TextBox5" classid="CLSID:8BD21D10-EC42-11CE-9E0D-00AA006002F3" width="529" height="140">

6.        Change C header files like iostream.h fstream.h and iomain.h in our project and COTS to C++ header files like iostream , fstream and iomain , and use namespace std for all s items.

7.        Int isn ’t the default return type of a function in VC8. Please declare the return type for all functions, if there is no return value, please use void .

< id="TextBox3" classid="CLSID:8BD21D10-EC42-11CE-9E0D-00AA006002F3" width="188" height="92" id="TextBox3" classid="CLSID:8BD21D10-EC42-11CE-9E0D-00AA006002F3" width="188" height="92">

8.        There is no implicit conversion from A* to const A*& . Please convert explicitly before you use it.

9.        A private or protect function can not be a friend function in VC8.

10.   hash_map and hash_set are now under namespace stdext .

11.   For Enum type, please do not use enum name.

This will only cause some warnings , anyway.

< id="TextBox4" classid="CLSID:8BD21D10-EC42-11CE-9E0D-00AA006002F3" width="219" height="113" id="TextBox4" classid="CLSID:8BD21D10-EC42-11CE-9E0D-00AA006002F3" width="219" height="113">

12.   Use MBCS for all projects now.

13.   Use /FORCE:MULTIPLE if there is link error of redefinition .

14.   There can not be more than one .rc file in one project if the project using link library dependencies . Please separate these projects.

15.   If there are link errors caused by COTS libraries, please upgrade those projects to VC8, too.

 

 

1: ACE
    :use ACE_5_6, add MFC_Debug, Release_Debug project, add ACE_HAS_MFC preprocessor,
    :add config.h file and add a statement "#include "ace/config-win32.h" under in the path"code/cots/ACE/5.6/ACE_wrappers/ace"
   
2: sharedAlarm: SEH problem
    __try
    {
        // actions
    }
    ...
    in "__try", we can not directly use STL C++ object destruction, change to:
    tryFunction()
    {
        // actions
    }
    ...
    __try
    {
        tryFunction();
    }
    ...
   
3: omniORB::onmiNotify
     omniORB_4.1.3 do not provide omniNotify service, we use old version omniNotify service code directly.
   
4: Windows Message Map
    VC8 request: ON_NOTIFY map function type must be "void (AFX_MSG_CALL CCmdTarget::*)(NMHDR*, LRESULT*)"
                 ON_MESSSAGE map function type must be "afx_msg LRESULT (CWnd::*)(WPARAM, LPARAM)"
                 ON_BN_CLICKED map function type must be "void (AFX_MSG_CALL CCmdTarget::*AFX_PMSG)(void)"
                 ON_THREAD_MESSAGE map function type must be "void (AFX_MSG_CALL CWinThread::*)(WPARAM, LPARAM)"
               
               
5: compiling error:
    1): error C2011: 'fd_set' : 'struct' type redefinition
        @reason: "winsock.h" and "winsock2.h" both include error
        @solution: use preprocessor: "WIN32_LEAN_AND_MEAN"
                                    or "_WINSOCKAPI_" force skip include "winsock.h"
       
    2): error C2011: 'timespec' : 'struct' type redefinition
        @reason:
        @solution: use preprocessor: "ACE_HAS_POSIX_TIME"
                                    or "_TIMERS_T_" force skip define "timespec" struct in head file ""
                                   
    3): error C3861: 'TryEnterCriticalSection': identifier not found
        @reason: ACE macro for windows can not find
        @solution: use preprocessor: "__POSIX_NT__"
       
    4): d:/t0271341/base_build/base/code/transactive/bus/alarm/shared_alarm/src/alarmindices.h(81)
        error C2440: 'specialization' : cannot convert from 'unsigned long TA_Base_Core::AlarmItem::* ' to 'unsigned short TA_Base_Core::AlarmItem::* '
        @reason:
        @solution: change "BOOST_MULTI_INDEX_MEMBER(TA_Base_Core::AlarmItem, unsigned short, alarmSeverity)" to
                       "BOOST_MULTI_INDEX_MEMBER(TA_Base_Core::AlarmItem, unsigned long, alarmSeverity)"
                      
    5): error C2668: 'pow' : ambiguous call to overloaded function
        @reason:
        @solution: use type cast, change parameters to proper types for function "pow"
       
    6): (1)e:/perforce/prestie/CODE_TA_BASE_4669_T01271300/transactive/core/sockets/src/ObservedSocket.h(332)
        (2)d:/t0271341/Base_build/Base/code/transactive/bus/modbus_comms/src/ModbusTcpConnection.h(29) : fatal error C1083: Cannot open include file: 'ace/ace_time_value.h': No such file or directory
        @reason: update ACE_5_3 to ACE_5_6
        @solution: add include head file "ace/Time_Value.h"
   
    7): d:/t0271341/base_build/base/code/transactive/app/scheduling/scheduling_manager/src/jobmanager.cpp(505) : error C2678: binary '>>=' : no operator found which takes a left-hand operand of type 'const CORBA::Any' (or there is no acceptable conversion)
        @reason: VC8 strict parameters check rule, omniORB_4.1.3 only have "CORBA::Boolean CORBA::Any::operator >>=(const char *&) const" method
        @solution: use "const char* id" replace "SchedulingAgentCorbaDef::JobID id" to extract "char *" date from Any type
                   or use "const_cast<const char*&>(XXX)"
               
    8): fatal error C1189: #error :  Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]  
        @reason:
        @solution: use proprocessor: "_AFXDLL"
       
    9): e:/perforce/prestie/code_ta_base_4669_t01271300/transactive/core/event_processing/src/commandscheduler.cpp(142) : error C2039: 'gettimeofday' : is not a member of 'ACE_OS'
        @reason: ACE_5_6 define "gettimeofday" in "ace/OS_NS_sys_time.h"
        @solution: include "ace/OS_NS_sys_time.h"
       
    10): e:/perforce/prestie/CODE_TA_BASE_4669_T01271300/transactive/core/sockets/src/ObservedSocket.h(332) :error C2079: 'TA_Base_Core::ObservedSocket::m_socketTimeout' uses undefined class 'ACE_Time_Value'
        @reason: ACE_5_6 do not automatically include "ace/Time_Value.h" in "ace/SOCK_Connector.h"
        @solution: include "ace/Time_Value.h"
       
    11): error C2039: 'PrologEndAddress' : is not a member of '_IMAGE_RUNTIME_FUNCTION_ENTRY'
        @reason:
        @solution: use preprocessor: "_ALPHA_"

    ): "using TA_Base_Core::NamedFilterAccessFactory::FilterNameList"
        change to :"typedef TA_Base_Core::NamedFilterAccessFactory::FilterNameList FilterNameList"
       
    ): use "ace/XXX" replace "../cots/ACE_X_X/ACE_wrapper/ace/XXX" for head include
   
    12):d:/t0271341/c830_build/4669/code/transactive/bus/maintenance_management/mms_api/src/mmsapi.h(41) : fatal error C1083: Cannot open include file: 'p_entry.h': No such file or directory
            copy file from "Base/code/cots/BEAMessageQ" code to "4669/sdk/include/cots"
            //BEA message queue stuff
            #include "p_entry.h"
            #include "p_return.h"
            #include "p_symbol.h"
            @reason: The cots BEA message havent been copy in the build.xml
            @solution: add copy statement in the build.xml

  13): error C4335: Mac file format detected: please convert the source file to either DOS or UNIX format
      For more detail: please reference to the "http://www.sapphiresteel.com/A-dialog-box-warns-about" website.
      [This is a Visual Studio warning. It occurs when you load a file containing a mix of Windows standard and non-standard line-endings.
       Windows line-endings take the form of a pair of characters (Carriage Return plus Linefeed) whereas Unix line-endings use just a single
       (Linefeed) character. You can easily tell the difference by loading a file into Windows Notepad. Those files which use Unix-style
       line-endings will wrap in Notepad; those using Windows line-endings won’t.]
 
  14): error C2228: left of '.setCallback' must have class/struct/union
       Embeded class cannt be used in the form of "using" in vs2005.

  15):  error C2039: 'm_pToolTip' : is not a member of '_AFX_THREAD_STATE'
             @reason: As a result, in MFC 7.0, the member variables were moved from AFX_THREAD_STATE to AFX_MODULE_THREAD_STATE
             @solution:

    16):1>------ Build started: Project: app.incidents.incident_manager, Configuration: Debug Win32 ------
            1>Compiling...
            1>CIncidentManagerListView.cpp
            1> WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
            1>c:/program files/microsoft visual studio 8/vc/atlmfc/include/afxcmn3.inl(20) : error C2065: 'CCM_SETWINDOWTHEME' : undeclared identifier
            1>c:/program files/microsoft visual studio 8/vc/include/vector(1323) : error C2825: '_MycontTy': must be a class or namespace when followed by '::'       
            line: 608, swap function error!!!!
            * Source:   $File: //depot/4669_T01271341/4669/transactive/app/incidents/incident_manager/src/CIncidentManagerListView.cpp $                                   
            appeared above problems when call teh swap method of stl.then commen it and write code by myself
       
6: link error:
    1): error BK1506:
        @reason: browse info file can not create correctly
        @solution: do not request creating browse info,
                Project->Properties->configuration Properties->C/C++->Browese Infomation->Enable Browse Infomation->None
   
    2): LINK : fatal error LNK1104: cannot open file './../../../../../../build/win32_nd/transactive/app/configuration/config_plugins/system_controller_groups/TA_SystemControllerGroupConfigPlugin.dll.intermediate.manifest'
        @reason: create manifest info error
        @solution: do not request creating manifest info,
                Project Property->Link->manifest File->Generate manifest:NO
   
    3): fatal error LNK1241: resource file TA_PlanTree_d.lib(PlanTree.res) already specified
        @reason: resource file redefine
        @solution: do not generate resouce file for single project if TA_Base_Bus.lib occur link res error: clean
                Properties->Configuration Properties->Resources->General->Resource File Name->$(IntDir)/$(InputName).res

  4):
       ------ Rebuild All started: Project: app.wild.wild_agent, Configuration: Debug Win32 ------
       Deleting intermediate and output files for project 'app.wild.wild_agent', configuration 'Debug|Win
       DataCorrelation.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) char * __cdecl ACE_OS::ctime_r(long const *,char *,int)"
        (__imp_?ctime_r@ACE_OS@@YAPADPBJPADH@Z) referenced in function "private: void __thiscall TA_IRS_App::DataCorrelation::submitCorrelationAlarm(long)"
        (?submitCorrelationAlarm@DataCorrelation@TA_IRS_App@@AAEXJ@Z)
       @reason: time_t is 64 bit, you cannt pass 32bit data to it, even if you use _USE_32BIT_TIME_T macro.
       @reason: you can pass type long data to time_t then call for ACE_OS::ctime_r function.
       

 


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/testing2007/archive/2009/07/11/4339927.aspx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值