1. Compiler Warning(level 1) C4482: nonstandard extension used: enum 'enum' used in qualified name.当在一个类型中指定了枚举类型时,你指定变量名称的时候不需要加枚举名。
if(rythtoken->getKeyType()==KEYLENGHTYPE::RYTH_LONG)
// warning C4482:使用了非标准扩展:限定名中使用了枚举“KEYLENGHTYPE” e:\engeneer\x51_8118\code\x51editor\chuyinmode\editor\TokenRyth.h 48 docktest
{
CTokenRythEx*rythtokenex=(CTokenRythEx*)token;
if(rythtokenex->getRythExType()==RYTHEXTYPE::RYTH_MIDDLE || rythtokenex->getRythExType()==RYTHEXTYPE::RYTH_END)
{
++it;
continue;
}
}
2. Compiler Warning(level 1) C4237:'keyword'keyword is not yet supported, but reserved for future use。
比如:void Camera::export(TiXmlElement* node)
{
mCameraAni->export(node);
} // warning C4237: 目前还不支持“export”关键字,但已保留该关键字供将来使用e:\engeneer\x51_8118\code\x51editor\chuyinmode\camera\Camera.h 82 docktest
将export改成别的名称即可。
3. Compiler Warning (level 1) C4005:'identifier' :macro redefinition
The macro identifier is defined twice. The compiler uses the secondmacro definition.
比如:
#define M_PI 3.14159265358979323846 //警告 3 warning C4005:“M_PI”: 宏重定义
1>d:\software\MicrosoftVisual Studio 2008 Teamsuit\file\VC\include\math.h(626) : warning C4005:“M_PI”:宏重定义
1> d:\software\qt\file1\include\qtcore\../../src/corelib/kernel/qmath.h(261):参见“M_PI”的前一个定义
将其中一个M_PI改为M_PI2即可
4.“未找到下列环境变量”:
比如:警告 104 未找到下列环境变量:
$(Configuration) 项目 docktest
当配置里用到某个环境变量而无法找到,可以将用到的环境变量修改名称。
5. warning C4244: conversion' conversion from 'type1' to 'type2', possible loss of data.
比如把int类型转换为short类型属于4级警告类型;
而把__int64转换成unsigned int属于3级警告类型。
比如下面:
typedef std::pair<Point,float> PointData;
std::vector<PointData> points_data;
points_data.push_back(std::make_pair(points[0].main_point,0));
//警告 warning C4244:“初始化”:从“const int”转换到“float”,可能丢失数据
.\Curve\CurveManager.cpp(86):参见对正在编译的函数模板实例化“std::pair<_Ty1,_Ty2>::pair<CurveLib::Point,int>(conststd::pair<_Ty1,int> &)”的引用
with
[
_Ty1=CurveLib::Point,
_Ty2=float
]
这里std::make_pair在推导类型的时候会认为类型是std::pair<Point, int>,和PointData类型不一样。所以,改成points_data.push_back(PointData(points[0].main_point,0));