开发者

ms vc++ iostream compile error

开发者 https://www.devze.com 2023-01-09 11:08 出处:网络
The following code in microsoft visual C++ 2010 express: #include <iostream> //using namespace std;

The following code in microsoft visual C++ 2010 express:

#include <iostream>
//using namespace std;

int main(int argc, char **argv)
{


 return(0);

}

gives me the errors:

1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\cmath(19): error C2061: syntax error : identifier 'acosf'
...
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\cmath(41): fatal error C1003: error count exceeds 100; stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

If comment out “#include ” then it compiles. I crea开发者_StackOverflow社区ted an project from existing code and edited to the above.


Change extension from .c to .cpp


Sorry for my bad English.

I'd the same problem an was resolved with this configuration parameter:

  1. Tools bar -> Project -> Properties (or Alt + F7).
  2. Configuration Properties -> C/C++ -> Advanced.
  3. Compile As

If you have in "Compile As" field the value "Compile as C Code" then you must change it to Default or "Compile as C++ Code".

I hope I have been helpful

Best regards


I don't have the express edition installed, but I bet it's because you have commented out the using namespace std; snippet.

Though your code sample compiles just fine in VS 2008 prof edition.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号