Errors when including string (In C++) - c++

When I add the string library (#include <string>) I get around 100 errors when compiling. Windows.h is already included so I don't know what the problem is.
Any help would be appreciated.
Errors are listed below.
Error 105 error C1003: error count exceeds 100; stopping compilation C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio 39 1 STablUpd
Error 99 error C2054: expected '(' to follow 'using' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio 36 1 STablUpd
Error 101 error C2054: expected '(' to follow 'using' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio 38 1 STablUpd
Error 5 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 28 1 STablUpd
Error 8 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 29 1 STablUpd
Error 12 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 30 1 STablUpd
Error 16 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 31 1 STablUpd
Error 20 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 32 1 STablUpd
Error 24 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 33 1 STablUpd
Error 28 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 34 1 STablUpd
Error 32 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 35 1 STablUpd
Error 35 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 37 1 STablUpd
Error 38 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 38 1 STablUpd
Error 42 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 39 1 STablUpd
Error 46 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 40 1 STablUpd
Error 50 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 41 1 STablUpd
Error 54 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 42 1 STablUpd
Error 58 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 43 1 STablUpd
Error 62 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 44 1 STablUpd
Error 65 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 46 1 STablUpd
Error 67 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 48 1 STablUpd
Error 70 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 49 1 STablUpd
Error 74 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 50 1 STablUpd
Error 78 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 51 1 STablUpd
Error 82 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 52 1 STablUpd
Error 86 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 53 1 STablUpd
Error 90 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 54 1 STablUpd
Error 94 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 55 1 STablUpd
Error 97 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 57 1 STablUpd
Error 103 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio 39 1 STablUpd
Error 64 error C2061: syntax error : identifier 'abs' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 46 1 STablUpd
Error 66 error C2061: syntax error : identifier 'acos' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 48 1 STablUpd
Error 4 error C2061: syntax error : identifier 'acosf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 28 1 STablUpd
Error 34 error C2061: syntax error : identifier 'acosl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 37 1 STablUpd
Error 68 error C2061: syntax error : identifier 'asin' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 48 1 STablUpd
Error 6 error C2061: syntax error : identifier 'asinf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 28 1 STablUpd
Error 36 error C2061: syntax error : identifier 'asinl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 37 1 STablUpd
Error 69 error C2061: syntax error : identifier 'atan' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 49 1 STablUpd
Error 71 error C2061: syntax error : identifier 'atan2' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 49 1 STablUpd
Error 9 error C2061: syntax error : identifier 'atan2f' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 29 1 STablUpd
Error 39 error C2061: syntax error : identifier 'atan2l' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 38 1 STablUpd
Error 7 error C2061: syntax error : identifier 'atanf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 29 1 STablUpd
Error 37 error C2061: syntax error : identifier 'atanl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 38 1 STablUpd
Error 72 error C2061: syntax error : identifier 'ceil' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 49 1 STablUpd
Error 10 error C2061: syntax error : identifier 'ceilf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 29 1 STablUpd
Error 40 error C2061: syntax error : identifier 'ceill' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 38 1 STablUpd
Error 102 error C2061: syntax error : identifier 'clearerr' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio 39 1 STablUpd
Error 73 error C2061: syntax error : identifier 'cos' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 50 1 STablUpd
Error 11 error C2061: syntax error : identifier 'cosf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 30 1 STablUpd
Error 75 error C2061: syntax error : identifier 'cosh' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 50 1 STablUpd
Error 13 error C2061: syntax error : identifier 'coshf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 30 1 STablUpd
Error 43 error C2061: syntax error : identifier 'coshl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 39 1 STablUpd
Error 41 error C2061: syntax error : identifier 'cosl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 39 1 STablUpd
Error 76 error C2061: syntax error : identifier 'exp' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 50 1 STablUpd
Error 14 error C2061: syntax error : identifier 'expf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 30 1 STablUpd
Error 44 error C2061: syntax error : identifier 'expl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 39 1 STablUpd
Error 77 error C2061: syntax error : identifier 'fabs' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 51 1 STablUpd
Error 15 error C2061: syntax error : identifier 'fabsf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 31 1 STablUpd
Error 45 error C2061: syntax error : identifier 'fabsl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 40 1 STablUpd
Error 104 error C2061: syntax error : identifier 'fclose' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio 39 1 STablUpd
Error 79 error C2061: syntax error : identifier 'floor' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 51 1 STablUpd
Error 17 error C2061: syntax error : identifier 'floorf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 31 1 STablUpd
Error 47 error C2061: syntax error : identifier 'floorl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 40 1 STablUpd
Error 80 error C2061: syntax error : identifier 'fmod' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 51 1 STablUpd
Error 18 error C2061: syntax error : identifier 'fmodf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 31 1 STablUpd
Error 48 error C2061: syntax error : identifier 'fmodl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 40 1 STablUpd
Error 81 error C2061: syntax error : identifier 'frexp' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 52 1 STablUpd
Error 19 error C2061: syntax error : identifier 'frexpf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 32 1 STablUpd
Error 49 error C2061: syntax error : identifier 'frexpl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 41 1 STablUpd
Error 96 error C2061: syntax error : identifier 'hypot' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 57 1 STablUpd
Error 98 error C2061: syntax error : identifier 'hypotf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 57 1 STablUpd
Error 83 error C2061: syntax error : identifier 'ldexp' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 52 1 STablUpd
Error 21 error C2061: syntax error : identifier 'ldexpf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 32 1 STablUpd
Error 51 error C2061: syntax error : identifier 'ldexpl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 41 1 STablUpd
Error 84 error C2061: syntax error : identifier 'log' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 52 1 STablUpd
Error 85 error C2061: syntax error : identifier 'log10' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 53 1 STablUpd
Error 23 error C2061: syntax error : identifier 'log10f' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 33 1 STablUpd
Error 53 error C2061: syntax error : identifier 'log10l' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 42 1 STablUpd
Error 22 error C2061: syntax error : identifier 'logf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 32 1 STablUpd
Error 52 error C2061: syntax error : identifier 'logl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 41 1 STablUpd
Error 87 error C2061: syntax error : identifier 'modf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 53 1 STablUpd
Error 25 error C2061: syntax error : identifier 'modff' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 33 1 STablUpd
Error 55 error C2061: syntax error : identifier 'modfl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 42 1 STablUpd
Error 88 error C2061: syntax error : identifier 'pow' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 53 1 STablUpd
Error 26 error C2061: syntax error : identifier 'powf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 33 1 STablUpd
Error 56 error C2061: syntax error : identifier 'powl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 42 1 STablUpd
Error 89 error C2061: syntax error : identifier 'sin' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 54 1 STablUpd
Error 27 error C2061: syntax error : identifier 'sinf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 34 1 STablUpd
Error 91 error C2061: syntax error : identifier 'sinh' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 54 1 STablUpd
Error 29 error C2061: syntax error : identifier 'sinhf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 34 1 STablUpd
Error 59 error C2061: syntax error : identifier 'sinhl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 43 1 STablUpd
Error 57 error C2061: syntax error : identifier 'sinl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 43 1 STablUpd
Error 92 error C2061: syntax error : identifier 'sqrt' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 54 1 STablUpd
Error 30 error C2061: syntax error : identifier 'sqrtf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 34 1 STablUpd
Error 60 error C2061: syntax error : identifier 'sqrtl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 43 1 STablUpd
Error 93 error C2061: syntax error : identifier 'tan' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 55 1 STablUpd
Error 31 error C2061: syntax error : identifier 'tanf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 35 1 STablUpd
Error 95 error C2061: syntax error : identifier 'tanh' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 55 1 STablUpd
Error 33 error C2061: syntax error : identifier 'tanhf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 35 1 STablUpd
Error 63 error C2061: syntax error : identifier 'tanhl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 44 1 STablUpd
Error 61 error C2061: syntax error : identifier 'tanl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath 44 1 STablUpd
Error 100 error C2061: syntax error : identifier 'using' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio 38 1 STablUpd

For anyone who is still looking for this:
"The solution to this was to make a right click on each C code and Properties>C/C++>Advanced>Compile As and check Compile as C++ Code(/TP)"
source: stack overflow :)

Related

Errors when compiling code from Practical Programming 2nd with Custom header

I'm starting with the first example from PPP2nd and immediately I have encountered significant issue with the custom header. I have put the header in the compiler include directory for ease of access. Both VS 2010 and 2012 will not compile. Your help would be greatly appreciated.
#include <std_lib_facilities.h>
int main()
{
cout << "Hello,world\n";
return 0;
}
Error 1 error C2868: 'std::vector<_Ty,_Alloc>::size_type' : illegal syntax for using-declaration; expected qualified-name c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 71 1 HelloWorld
Error 2 error C2143: syntax error : missing ';' before '=' c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 71 1 HelloWorld
Error 3 error C2238: unexpected token(s) preceding ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 71 1 HelloWorld
Error 4 error C2061: syntax error : identifier 'initializer_list' c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 80 1 HelloWorld
Error 5 error C2535: 'Vector<T>::Vector(void)' : member function already defined or declared c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 80 1 HelloWorld
Error 6 error C2868: 'std::basic_string<_Elem,_Traits,_Alloc>::size_type' : illegal syntax for using-declaration; expected qualified-name c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 102 1 HelloWorld
Error 7 error C2143: syntax error : missing ';' before '=' c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 102 1 HelloWorld
Error 8 error C2238: unexpected token(s) preceding ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 102 1 HelloWorld
Error 9 error C2143: syntax error : missing ';' before '{' c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 213 1 HelloWorld
Error 10 error C2275: 'std::uniform_int_distribution<>' : illegal use of this type as an expression c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 213 1 HelloWorld
Error 11 error C2143: syntax error : missing ';' before '}' c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 213 1 HelloWorld
Error 12 error C2988: unrecognizable template declaration/definition c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 222 1 HelloWorld
Error 13 error C2059: syntax error : 'using' c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 222 1 HelloWorld
Error 14 error C2143: syntax error : missing ';' before '<' c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 243 1 HelloWorld
Error 15 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 243 1 HelloWorld
Error 16 error C2988: unrecognizable template declaration/definition c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 243 1 HelloWorld
Error 17 error C2059: syntax error : '<' c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 243 1 HelloWorld
Error 18 error C2143: syntax error : missing ';' before '{' c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 251 1 HelloWorld
Error 19 error C2447: '{' : missing function header (old-style formal list?) c:\program files (x86)\microsoft visual studio 11.0\vc\include\std_lib_facilities.h 251 1 HelloWorld
20 IntelliSense: type name is not allowed c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\std_lib_facilities.h 213 81 HelloWorld
21 IntelliSense: expected a ';' c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\std_lib_facilities.h 213 107 HelloWorld
Upgrading to visual studio 2015 allowed me to compile the source file with the customer header file "std_lib_facilities.h" provided by the author.
Thanks all for the guidance and feedback.

Errors in Xutility after defining _SCL_SECURE_NO_WARNINGS

I am trying to implement a class for calculating the dot product of two vectors.
float dotProduct(vec2 v1, vec2 v2)
{
if (v1.Length() != v2.Length()) { return NULL; }
return (float)std::inner_product(v1.x, v1.y, v2.x, 0.0);
}
When I complie this i get:
Error 1 error C4996: 'std::_Inner_product2': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\numeric 121
So i add #define _SCL_SECURE_NO_WARNINGS
But then I get a bunch of errors in xutility
Error 1 error C2825: '_Iter': must be a class or namespace when followed by '::' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 371
Error 2 error C2039: 'iterator_category' : is not a member of '`global namespace'' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 371
Error 3 error C2146: syntax error : missing ';' before identifier 'iterator_category' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 371
Error 4 error C2602: 'std::iterator_traits<_InIt>::iterator_category' is not a member of a base class of 'std::iterator_traits<_InIt>' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 371
Error 5 error C2868: 'std::iterator_traits<_InIt>::iterator_category' : illegal syntax for using-declaration; expected qualified-name C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 371
Error 6 error C2825: '_Iter': must be a class or namespace when followed by '::' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 372
Error 7 error C2039: 'value_type' : is not a member of '`global namespace'' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 372
Error 8 error C2146: syntax error : missing ';' before identifier 'value_type' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 372
Error 9 error C2602: 'std::iterator_traits<_InIt>::value_type' is not a member of a base class of 'std::iterator_traits<_InIt>' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 372
Error 10 error C2868: 'std::iterator_traits<_InIt>::value_type' : illegal syntax for using-declaration; expected qualified-name C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 372
Error 11 error C2825: '_Iter': must be a class or namespace when followed by '::' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 373
Error 12 error C2039: 'difference_type' : is not a member of '`global namespace'' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 373
Error 13 error C2146: syntax error : missing ';' before identifier 'difference_type' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 373
Error 14 error C2602: 'std::iterator_traits<_InIt>::difference_type' is not a member of a base class of 'std::iterator_traits<_InIt>' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 373
Error 15 error C2868: 'std::iterator_traits<_InIt>::difference_type' : illegal syntax for using-declaration; expected qualified-name C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 373
Error 16 error C2825: '_Iter': must be a class or namespace when followed by '::' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 375
Error 17 error C2039: 'pointer' : is not a member of '`global namespace'' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 375
Error 18 error C2146: syntax error : missing ';' before identifier 'pointer' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 375
Error 19 error C2602: 'std::iterator_traits<_InIt>::pointer' is not a member of a base class of 'std::iterator_traits<_InIt>' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 375
Error 20 error C2868: 'std::iterator_traits<_InIt>::pointer' : illegal syntax for using-declaration; expected qualified-name C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 375
Error 21 error C2825: '_Iter': must be a class or namespace when followed by '::' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 376
Error 22 error C2039: 'reference' : is not a member of '`global namespace'' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 376
Error 23 error C2146: syntax error : missing ';' before identifier 'reference' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 376
Error 24 error C2602: 'std::iterator_traits<_InIt>::reference' is not a member of a base class of 'std::iterator_traits<_InIt>' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 376
Error 25 error C2868: 'std::iterator_traits<_InIt>::reference' : illegal syntax for using-declaration; expected qualified-name C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 376
Error 26 error C2665: 'std::_Debug_range2' : none of the 2 overloads could convert all the argument types C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 584
Check the documentation
http://en.cppreference.com/w/cpp/algorithm/inner_product
You are passing values not the iterators. this fuction can create product for longer vectors, so it requires start and end of the data, try this;
std::inner_product(v1.begin(), v1.end(), v2.begin(), 0.0);

build error with xtgmath.h and cmath

I recently installed GLUT, and GLEW, and was running some OpenGL example code the other day. I come back to my project and try to run some basic c++ code:
#include <iostream>
int main()
{
using namespace std;
cout << "Come up and C++ me some time.";
cout << endl;
cout << "You won’t regret it!" << endl;
return 0;
}
I am using Visual Studio 2013, and the file is C++. Anyway, I get these errors:
1>------ Build started: Project: testGlut1, Configuration: Debug Win32 ------
1> Source.cpp
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtgmath.h(214): error C2220: warning treated as error - no 'object' file generated
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtgmath.h(214): warning C4602: #pragma pop_macro : 'new' no previous #pragma push_macro for this identifier
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtgmath.h(215): warning C4193: #pragma warning(pop) : no matching '#pragma warning(push)'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtgmath.h(216): warning C4161: #pragma pack(pop...) : more pops than pushes
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(23): error C2061: syntax error : identifier 'abs'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(23): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(23): error C2061: syntax error : identifier 'acos'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(23): error C2061: syntax error : identifier 'asin'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(24): error C2061: syntax error : identifier 'atan'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(24): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(24): error C2061: syntax error : identifier 'atan2'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(24): error C2061: syntax error : identifier 'ceil'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(25): error C2061: syntax error : identifier 'cos'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(25): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(25): error C2061: syntax error : identifier 'cosh'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(25): error C2061: syntax error : identifier 'exp'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(26): error C2061: syntax error : identifier 'fabs'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(26): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(26): error C2061: syntax error : identifier 'floor'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(26): error C2061: syntax error : identifier 'fmod'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(27): error C2061: syntax error : identifier 'frexp'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(27): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(27): error C2061: syntax error : identifier 'ldexp'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(27): error C2061: syntax error : identifier 'log'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(28): error C2061: syntax error : identifier 'log10'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(28): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(28): error C2061: syntax error : identifier 'modf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(28): error C2061: syntax error : identifier 'pow'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(29): error C2061: syntax error : identifier 'sin'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(29): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(29): error C2061: syntax error : identifier 'sinh'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(29): error C2061: syntax error : identifier 'sqrt'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(30): error C2061: syntax error : identifier 'tan'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(30): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(30): error C2061: syntax error : identifier 'tanh'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(32): error C2061: syntax error : identifier 'acosf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(32): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(32): error C2061: syntax error : identifier 'asinf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(33): error C2061: syntax error : identifier 'atanf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(33): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(33): error C2061: syntax error : identifier 'atan2f'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(33): error C2061: syntax error : identifier 'ceilf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(34): error C2061: syntax error : identifier 'cosf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(34): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(34): error C2061: syntax error : identifier 'coshf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(34): error C2061: syntax error : identifier 'expf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(35): error C2061: syntax error : identifier 'fabsf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(35): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(35): error C2061: syntax error : identifier 'floorf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(35): error C2061: syntax error : identifier 'fmodf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(36): error C2061: syntax error : identifier 'frexpf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(36): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(36): error C2061: syntax error : identifier 'ldexpf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(36): error C2061: syntax error : identifier 'logf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(37): error C2061: syntax error : identifier 'log10f'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(37): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(37): error C2061: syntax error : identifier 'modff'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(37): error C2061: syntax error : identifier 'powf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(38): error C2061: syntax error : identifier 'sinf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(38): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(38): error C2061: syntax error : identifier 'sinhf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(38): error C2061: syntax error : identifier 'sqrtf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(39): error C2061: syntax error : identifier 'tanf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(39): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(39): error C2061: syntax error : identifier 'tanhf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(41): error C2061: syntax error : identifier 'acosl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(41): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(41): error C2061: syntax error : identifier 'asinl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(42): error C2061: syntax error : identifier 'atanl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(42): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(42): error C2061: syntax error : identifier 'atan2l'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(42): error C2061: syntax error : identifier 'ceill'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(43): error C2061: syntax error : identifier 'cosl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(43): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(43): error C2061: syntax error : identifier 'coshl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(43): error C2061: syntax error : identifier 'expl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(44): error C2061: syntax error : identifier 'fabsl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(44): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(44): error C2061: syntax error : identifier 'floorl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(44): error C2061: syntax error : identifier 'fmodl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(45): error C2061: syntax error : identifier 'frexpl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(45): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(45): error C2061: syntax error : identifier 'ldexpl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(45): error C2061: syntax error : identifier 'logl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(46): error C2061: syntax error : identifier 'log10l'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(46): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(46): error C2061: syntax error : identifier 'modfl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(46): error C2061: syntax error : identifier 'powl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(47): error C2061: syntax error : identifier 'sinl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(47): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(47): error C2061: syntax error : identifier 'sinhl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(47): error C2061: syntax error : identifier 'sqrtl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(48): error C2061: syntax error : identifier 'tanl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(48): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(48): error C2061: syntax error : identifier 'tanhl'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(50): warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(50): error C2054: expected '(' to follow 'using'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(50): error C2061: syntax error : identifier 'using'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(52): error C2061: syntax error : identifier 'acosh'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(52): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(52): error C2061: syntax error : identifier 'asinh'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(52): error C2061: syntax error : identifier 'atanh'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(53): error C2061: syntax error : identifier 'cbrt'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(53): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(53): error C2061: syntax error : identifier 'erf'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(53): error C2061: syntax error : identifier 'erfc'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\cmath(53): fatal error C1003: error count exceeds 100; stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The compiler processes your file as C. Specify that need to be compiled as C ++.(http://msdn.microsoft.com/en-us/library/032xwy55.aspx)

expected '(' to follow 'WINGDIAPI'

I get the above error and about 101 others (total 102 errors). I searched around and the only solution I found is to include the windows.h library before gl.h. But I am already doing that. So what is the solution? Can anyone help me? I am using glut and opengl. Below is my include process. If you request more of my code let me know
#include <stdio.h> // Standard C/C++ Input-Output
#include <math.h> // Math Functions
#include <windows.h> // Standard Header For MSWindows Applications
#include <GL/gl.h>
#include <time.h>
#include <stdlib.h>
#include "SOIL.h"
and this is the complete error list:
Error 1 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1152
Error 2 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1152
Error 3 error C2146: syntax error : missing ',' before identifier 'glAccum' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1152
Error 4 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1152
Error 5 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1152
Error 6 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1153
Error 7 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1153
Error 8 error C2146: syntax error : missing ',' before identifier 'glAlphaFunc' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1153
Error 9 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1153
Error 10 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1153
Error 11 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1154
Error 12 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1154
Error 13 error C2146: syntax error : missing ',' before identifier 'glAreTexturesResident' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1154
Error 14 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1154
Error 15 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1154
Error 16 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1155
Error 17 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1155
Error 18 error C2146: syntax error : missing ',' before identifier 'glArrayElement' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1155
Error 19 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1155
Error 20 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1155
Error 21 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1156
Error 22 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1156
Error 23 error C2146: syntax error : missing ',' before identifier 'glBegin' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1156
Error 24 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1156
Error 25 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1156
Error 26 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1157
Error 27 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1157
Error 28 error C2146: syntax error : missing ',' before identifier 'glBindTexture' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1157
Error 29 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1157
Error 30 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1157
Error 31 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1158
Error 32 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1158
Error 33 error C2146: syntax error : missing ',' before identifier 'glBitmap' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1158
Error 34 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1158
Error 35 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1158
Error 36 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1159
Error 37 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1159
Error 38 error C2146: syntax error : missing ',' before identifier 'glBlendFunc' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1159
Error 39 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1159
Error 40 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1159
Error 41 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1160
Error 42 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1160
Error 43 error C2146: syntax error : missing ',' before identifier 'glCallList' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1160
Error 44 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1160
Error 45 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1160
Error 46 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1161
Error 47 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1161
Error 48 error C2146: syntax error : missing ',' before identifier 'glCallLists' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1161
Error 49 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1161
Error 50 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1161
Error 51 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1162
Error 52 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1162
Error 53 error C2146: syntax error : missing ',' before identifier 'glClear' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1162
Error 54 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1162
Error 55 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1162
Error 56 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1163
Error 57 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1163
Error 58 error C2146: syntax error : missing ',' before identifier 'glClearAccum' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1163
Error 59 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1163
Error 60 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1163
Error 61 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1164
Error 62 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1164
Error 63 error C2146: syntax error : missing ',' before identifier 'glClearColor' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1164
Error 64 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1164
Error 65 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1164
Error 66 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1165
Error 67 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1165
Error 68 error C2146: syntax error : missing ',' before identifier 'glClearDepth' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1165
Error 69 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1165
Error 70 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1165
Error 71 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1166
Error 72 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1166
Error 73 error C2146: syntax error : missing ',' before identifier 'glClearIndex' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1166
Error 74 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1166
Error 75 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1166
Error 76 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1167
Error 77 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1167
Error 78 error C2146: syntax error : missing ',' before identifier 'glClearStencil' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1167
Error 79 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1167
Error 80 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1167
Error 81 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1168
Error 82 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1168
Error 83 error C2146: syntax error : missing ',' before identifier 'glClipPlane' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1168
Error 84 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1168
Error 85 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1168
Error 86 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1169
Error 87 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1169
Error 88 error C2146: syntax error : missing ',' before identifier 'glColor3b' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1169
Error 89 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1169
Error 90 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1169
Error 91 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1170
Error 92 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1170
Error 93 error C2146: syntax error : missing ',' before identifier 'glColor3bv' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1170
Error 94 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1170
Error 95 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1170
Error 96 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1171
Error 97 error C2085: 'APIENTRY' : not in formal parameter list c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1171
Error 98 error C2146: syntax error : missing ',' before identifier 'glColor3d' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1171
Error 99 error C2143: syntax error : missing ';' before '(' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1171
Error 100 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1171
Error 101 error C2054: expected '(' to follow 'WINGDIAPI' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1172
Error 102 error C1003: error count exceeds 100; stopping compilation c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1172
This is commonly caused by defining WIN32_LEAN_AND_MEAN, either in stdafx.h or in the compilation settings.
Defining that macro before including windows.h automatically excludes infrequently used header files and definitions.
Since you are using OpenGL you are using some of those infrequently used headers, so you need to turn that off.
It may appear in a header such as stdafx.h like so:
#define WIN32_LEAN_AND_MEAN
Or it may be in the compilation settings like so:
-DWIN32_LEAN_AND_MEAN
You forget to include windows.h right before gl.h. From http://www.opengl.org/archives/resources/faq/technical/gettingstarted.htm:
Error:
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2054: expected '(' to
follow 'WINGDIAPI'
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2085: 'APIENTRY' : not in
formal parameter list
Didn't #include windows.h or included it after gl.h. Source files that
use neither GLUT nor MFC, but which make calls to OpenGL, should:
#include <windows.h>
#include <GL/gl.h>
Works for me.
Also, make sure you are not using precompiled header
OK I had the same problem and i fixed it . Just Make sure you dont have other files in your project (precompiled header /.c/ .cpp).Delete them and leave only thouse wich you need and it will work
It seems like you are using the SOIL library. Make sure that windows.h is included (the preprocessor might take a different branch). Ensure that WIN32 is defined if you do not want to change the SOIL library. If not, you can replace it by _WIN32.
This all seems to be pretty much wrong guys (sorry!).
Simply because this loudly proclaims that
including windows.h is needed does not mean that
including windows.h should be done.
OpenGL is an OPEN STANDARD PROTOCOL INTERFACE SPEC. Thus,
its related STANDARD headers (GL/gl.h , GL/glu.h etc.) should DEFINITELY NOT be causing massive pollution with
whichever proprietary crap some proprietary vendors manage to come up with.
Specifically, I am talking of
woefully Win32-specific macros WINGDIAPI and APIENTRY, which
have been ADDED TO
previously standard GL header content (hint: see SGI text in that header), and which
cause these GL headers to NOT be a properly self-contained and generic interface any more!!
(i.e., requiring a whole ton of wingdi.h and kitchen sink etc., with the massive consequence of globally polluting your entire source code scope with this wholly environment-specific crap, windows.h etc)
Thus, to rectify this dire situation, things likely should be done like this:
create purpose-specific local headers which try to do a maximally precise job of
supplying these few required-but-missing (non-self-contained header!) environment-specific parts:
APIENTRY definition header file
WINGDIAPI definition header file
supply these missing parts (broken since non-self-contained OpenGL interface...) by including these helper headers everywhere that you include related official GL headers (interfaces!) - on the Windows-proprietary platform only (#ifdef _WIN32)!
take uttermost care to keep any and all Windows-proprietary transition-to-OpenGL helpers (those which make use of Win32 HDC etc., e.g. wgl*() APIs) handling to their own properly strictly isolated translation unit (.cpp)
keep all of your standard / generic / cross-platform / universal (read: innocent ;-)) OpenGL implementation handling parts to their own translation units (thus, cleanly NOT infected by environment-specific windows.h crap, thus properly working on all platforms)
profit! (hopefully)
Topically related reference (potentially already helpful):
github WindowsHModular
Topically related stuff:
Win32 min / max macro "namespace" / symbol pollution (early-define NOMINMAX and prefer using __min / __max where still needed)
Win32 near / far macros
The fact remains that it is very intrusive behaviour to be polluting a standard, minimalist(?) interface (OpenGL) with negligible parts (in this case, symbol export macros) of a factually foreign toolkit, thereby necessitating sufficiently (header-side!) global-scope pollution of supposedly generic user code with wholly environment-specific crap: windows.h (as opposed to simply ensuring that these public interface headers have their own compiler-specific symbol export macros provided within scope already).
tl;dr: "One platform enabled, eleven platforms broken - job achieved"

Syntax errors when trying to use CString in Visual C++

My project is not happy regarding include cstring. It generates errors like:
Error 10 error C2061: syntax error : identifier 'using' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 18 1 fgdll
Error 95 error C2061: syntax error : identifier 'tanhf' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cmath 26 1 fgdll
Error 93 error C2061: syntax error : identifier 'tanf' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cmath 26 1 fgdll
Error 51 error C2061: syntax error : identifier 'strxfrm' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 26 1 fgdll
Error 49 error C2061: syntax error : identifier 'strtok' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 26 1 fgdll
Error 47 error C2061: syntax error : identifier 'strstr' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 25 1 fgdll
...
How can I solve this problem?
Ok, try this:
Right click on each piece of code and go to:
Properties > C/C++ > Advanced > Compile As and check Compile as C++ Code(/TP)