VC6工程转VC9工程常见警告
2010-07-25 15:57
127 查看
1. WINVER not defined. Defaulting to 0x0600 (Windows Vista)
如果没有定义WINVER,默认的支持操作系统版本为Vista,可以在工程设置中增加WINVER=0x500;_WIN32_WINNT=0x500; 定义支持的操作系统版本为Win2000。
2. warning C4996: 'strcpy': This function or variable may be unsafe.
C4996的警告是针对C语言中不安全的字符串函数提出的,可以在工程设置中增加宏_CRT_SECURE_NO_WARNINGS来取消这一类的警告。
3. warning C4996: 'itoa': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _itoa.
根据ISO C++标准,itoa应当为_itoa。
类似的警告有:
warning C4996: 'strupr': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strupr
warning C4996: 'strlwr': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strlwr
4. warning LNK4017: DESCRIPTION statement not supported for the target platform; ignored
VC9的连接器不再支持.def文件中的DESCRIPTION。
5. warning C4244: '=' : conversion from '__time64_t' to 'long', possible loss of data
CTime::GetTime()返回的是__time64_t类型了。
VC9的MFC一些函数返回类型都改成__int64了。
6. warning C4996: 'ATL::CRegKey::QueryValue': CRegKey::QueryValue(TCHAR *value, TCHAR *valueName) has been superseded by CRegKey::QueryStringValue and CRegKey::QueryMultiStringValue
CRegKey有了很多新成员,针对不同的数据类型都有相应的方法:
QueryBinaryValue
QueryDWORDValue
QueryGUIDValue
QueryMultiStringValue
QueryQWORDValue
QueryStringValue
它们能更安全的返回数据,QueryValue已不建议使用。
7. warning C4996: 'CWinApp::Enable3dControlsStatic': CWinApp::Enable3dControlsStatic is no longer needed. You should remove this call.
CWinApp::Enable3dControls和CWinApp::Enable3dControlsStatic都不需要了。
8. warning C4706: assignment within conditional expression
当你写出if (a = b) 或者 if (a = func()) 这样的代码时就会出现这样的警告。有时候if (a = func())确实是你想要的,那么改为if ((a = func()) != NULL)会消除警告。
9. 1>./VehmscX.def : warning LNK4222: exported symbol 'DllCanUnloadNow' should not be assigned an ordinal
1>./VehmscX.def : warning LNK4222: exported symbol 'DllGetClassObject' should not be assigned an ordinal
1>./VehmscX.def : warning LNK4222: exported symbol 'DllRegisterServer' should not be assigned an ordinal
1>./VehmscX.def : warning LNK4222: exported symbol 'DllUnregisterServer' should not be assigned an ordinal
控件工程编译出的警告,将.def文件中相关函数的序数删掉就可以了。
The following symbols should not be exported by ordinal:
DllCanUnloadNow
DllGetClassObject
DllGetClassFactoryFromClassString
DllInstall
DllRegisterServer
DllRegisterServerEx
DllUnregisterServer
如果没有定义WINVER,默认的支持操作系统版本为Vista,可以在工程设置中增加WINVER=0x500;_WIN32_WINNT=0x500; 定义支持的操作系统版本为Win2000。
2. warning C4996: 'strcpy': This function or variable may be unsafe.
C4996的警告是针对C语言中不安全的字符串函数提出的,可以在工程设置中增加宏_CRT_SECURE_NO_WARNINGS来取消这一类的警告。
3. warning C4996: 'itoa': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _itoa.
根据ISO C++标准,itoa应当为_itoa。
类似的警告有:
warning C4996: 'strupr': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strupr
warning C4996: 'strlwr': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strlwr
4. warning LNK4017: DESCRIPTION statement not supported for the target platform; ignored
VC9的连接器不再支持.def文件中的DESCRIPTION。
5. warning C4244: '=' : conversion from '__time64_t' to 'long', possible loss of data
CTime::GetTime()返回的是__time64_t类型了。
VC9的MFC一些函数返回类型都改成__int64了。
6. warning C4996: 'ATL::CRegKey::QueryValue': CRegKey::QueryValue(TCHAR *value, TCHAR *valueName) has been superseded by CRegKey::QueryStringValue and CRegKey::QueryMultiStringValue
CRegKey有了很多新成员,针对不同的数据类型都有相应的方法:
QueryBinaryValue
QueryDWORDValue
QueryGUIDValue
QueryMultiStringValue
QueryQWORDValue
QueryStringValue
它们能更安全的返回数据,QueryValue已不建议使用。
7. warning C4996: 'CWinApp::Enable3dControlsStatic': CWinApp::Enable3dControlsStatic is no longer needed. You should remove this call.
CWinApp::Enable3dControls和CWinApp::Enable3dControlsStatic都不需要了。
8. warning C4706: assignment within conditional expression
当你写出if (a = b) 或者 if (a = func()) 这样的代码时就会出现这样的警告。有时候if (a = func())确实是你想要的,那么改为if ((a = func()) != NULL)会消除警告。
9. 1>./VehmscX.def : warning LNK4222: exported symbol 'DllCanUnloadNow' should not be assigned an ordinal
1>./VehmscX.def : warning LNK4222: exported symbol 'DllGetClassObject' should not be assigned an ordinal
1>./VehmscX.def : warning LNK4222: exported symbol 'DllRegisterServer' should not be assigned an ordinal
1>./VehmscX.def : warning LNK4222: exported symbol 'DllUnregisterServer' should not be assigned an ordinal
控件工程编译出的警告,将.def文件中相关函数的序数删掉就可以了。
The following symbols should not be exported by ordinal:
DllCanUnloadNow
DllGetClassObject
DllGetClassFactoryFromClassString
DllInstall
DllRegisterServer
DllRegisterServerEx
DllUnregisterServer
相关文章推荐
- 用VC8.0编译Ogre工程常见问题
- VC6工程转VC9工程常见错误
- 《Visual C++ 2010入门教程》系列四:VC2010中初学者常见错误、警告和问题
- 《Visual C++ 2010入门教程》系列四:VC2010中初学者常见错误、警告和问题(转)
- 让你提前认识软件开发(51):VC++集成开发环境中Linux下Pclint工程的配置方法及常见错误修改
- VC中的两个常见警告:LNK4098和LNK4099
- 如何在VC工程生成的exe当中添加不常见的资源(比如说zip包)
- 《Visual C++ 2010入门教程》系列四:VC2010中初学者常见错误、警告和问题
- VC6工程转VC9工程常见错误
- 《Visual C++ 2010入门教程》系列四:VC2010中初学者常见错误、警告和问题
- VC2010中初学者常见的错误、警告和问题
- VS C工程【建立空工程】【打开VC6++工程:警告1 warning C4996: 'scanf': This function or variable may be】【C语言运行窗口复制粘贴编辑】
- vc工程的常见开发环境的配置
- vc的IDE里,在工程窗口里点右键 "添加文件.... "没反应
- VC++2010工程中加入SplashScreen
- 巧用VC工程下的rc文件
- vc常见问题108问-很有资料价值
- VC++的工程文件说明
- VC++常见调试错误
- 『ANDROID』App工程结构搭建:几种常见Android代码架构分析