int main() { using namespace std; cout << "Hello World!" << end" /> int main() { using namespace std; cout << "Hello World!" << end" /> int main() { using namespace std; cout << "Hello World!" << end"/>

Why can a "hello world" c++ program raise so many "iosfwd" errors in visual studio 2015?

730 Views Asked by At

I just typed this "hello world" c++ program in visual studio 2015 :

#include<iostream>

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

and then, vs told me :

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? And one of the situations in iosfwd is: Error C2065 'EOF': undeclared identifier

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.

1

There are 1 best solutions below

0
Ying Dai On

Same issue for me. Tried to include <memory> before <iostream>. The issue disappeared.