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: