简体   繁体   English

为什么“ hello world” c ++程序会在Visual Studio 2015中引发这么多“ iosfwd”错误?

[英]Why can a “hello world” c++ program raise so many “iosfwd” errors in visual studio 2015?

I just typed this "hello world" c++ program in visual studio 2015 : 我刚刚在Visual Studio 2015中输入了这个“ hello world” c ++程序:

#include<iostream>

int main() 
{
    using namespace std;
    cout << "Hello World!" << endl;
    return 0;
}

and then, vs told me : 然后,vs告诉我:

Error   C2061   syntax error: identifier 'fpos_t'   
Error   C3646   'seekpos': unknown override 
Error   C2059   syntax error: '('       
Error   C2334   unexpected token(s) preceding '{'; skipping apparent function body      
Error   C3646   '_Fpos': unknown override specifier
Error   C4430   missing type specifier - int assumed. Note: C++ does not support default-int
Error   C2065   'EOF': undeclared identifier

these errors had the same source: 这些错误的来源相同:

f:\microsoft visual studio 14.0\vc\include\iosfwd

well, please ignore my file path. 好吧,请忽略我的文件路径。 But iosfwd seems to be the core of problems? 但是iosfwd似乎是问题的核心? And one of the situations in iosfwd is: Error C2065 'EOF': undeclared identifier iosfwd中的情况之一是: 错误 iosfwd ':未声明的标识符

I am searching for a long time. 我正在寻找很长一段时间。 But no use. 但是没用。 Please help or try to give some ideas how to achieve this. 请帮助或尝试给出一些想法来实现这一目标。 Thanks in advance. 提前致谢。


If i create a new Win32 Console Application" instead of Empty Project , and use #include "stdafx.h" (if I don't include"stdafx.h", it also goes wrong). Then my program runs successfully. So, what's the secret of visual studio. 如果我创建一个新的Win32 Console Application"而不是Empty Project ,并使用#include "stdafx.h" (如果我不包括“ stdafx.h”,它也会出错)。那么我的程序将成功运行。因此, Visual Studio的秘密是什么。

Same issue for me. 对我来说也是一样。 Tried to include <memory> before <iostream> . 尝试在<iostream>之前包含<memory> <iostream> The issue disappeared. 问题消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM