变量不是类型名称错误 [英] Variable is not a type name error
问题描述
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout << "hello world" << endl;
return 0;
}
代码如上,非常简单的例子,但我得到了很多错误,如:
The code is as above, very simple example, but I get many errors like:
变量_CRTIMP_ALTERNATIVE"不是类型名称 Project2 d:\tools\VC\include\string.h 98
variable "_CRTIMP_ALTERNATIVE" is not a type name Project2 d:\tools\VC\include\string.h 98
变量errno_t"不是类型名称 Project2 d:\tools\VC\include\crtdbg.h 848
variable "errno_t" is not a type name Project2 d:\tools\VC\include\crtdbg.h 848
等等...
图片在这里:http://postimg.org/image/adhcs4p39/
推荐答案
您的图像看起来像 VS2015,但 _CRTIMP_ALTERNATIVE 宏和 errno_t 类型在我能找到的 2015 标头中未使用或定义.它们在 VS2012 头文件中(都在 crtdefs.h 中).看起来您正在针对混合的头文件进行编译,其中一些来自一个编译器版本,一些来自另一个版本.
Your image looks like VS2015, but the _CRTIMP_ALTERNATIVE macro and errno_t type are not used or defined in the 2015 headers that I can find. They are in the VS2012 headers (both are in crtdefs.h). This looks like you are compiling against a mix of header files, with some from one compiler version and some from the other.
这篇关于变量不是类型名称错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!