Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ms vc++ iostream compile error

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 created an project from existing code and edited to the above.

like image 360
brian Avatar asked Nov 29 '22 05:11

brian


2 Answers

Change extension from .c to .cpp

like image 168
Michal Z Avatar answered Dec 09 '22 09:12

Michal Z


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

like image 39
Ko-Barde Avatar answered Dec 09 '22 08:12

Ko-Barde