Can't include cliext headers (for c++ cli, Visual Studio) - c++

Even with a clean empty dll project that is compiled with /clr and only consists of a single cpp file with
#include <cliext/vector>
and nothing else, the compiler spews
1>------ Build started: Project: test1, Configuration: Debug x64 ------
1>Source.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\iterator(3331,1): error C2061: syntax error: identifier 'value_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\iterator(3352): message : see reference to class template instantiation 'cliext::BCL_reference<_Cont_t,_Is_ref>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\iterator(3332,1): error C2805: binary 'operator =' has too few parameters
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\iterator(3332,1): error C2333: 'cliext::BCL_reference<_Cont_t,_Is_ref>::operator =': error in function declaration; skipping function body
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\iterator(3340,1): error C2833: 'operator value_type' is not a recognized operator or type
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\iterator(3341,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\iterator(3351,1): error C3646: '_Myval': unknown override specifier
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\iterator(3351,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(872,1): error C2833: 'operator _Mycont_it' is not a recognized operator or type
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1083): message : see reference to class template instantiation 'cliext::impl::vector_base<_Value_t,_Is_ref>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(872,1): error C2059: syntax error: 'newline'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(873,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(878,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(878,1): error C2535: 'cliext::impl::vector_base<_Value_t,_Is_ref>::vector_base(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(856): message : see declaration of 'cliext::impl::vector_base<_Value_t,_Is_ref>::vector_base'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(883,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(883,1): error C2535: 'cliext::impl::vector_base<_Value_t,_Is_ref>::vector_base(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(856): message : see declaration of 'cliext::impl::vector_base<_Value_t,_Is_ref>::vector_base'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(894,1): error C2061: syntax error: identifier '_Myenum_it'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(894,1): error C2535: 'cliext::impl::vector_base<_Value_t,_Is_ref>::vector_base(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(856): message : see declaration of 'cliext::impl::vector_base<_Value_t,_Is_ref>::vector_base'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(946,1): error C2061: syntax error: identifier 'iterator'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(953,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(960,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(962,1): error C2535: 'void cliext::impl::vector_base<_Value_t,_Is_ref>::_Insert(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(953): message : see declaration of 'cliext::impl::vector_base<_Value_t,_Is_ref>::_Insert'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(971,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(973,1): error C2535: 'void cliext::impl::vector_base<_Value_t,_Is_ref>::_Insert(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(953): message : see declaration of 'cliext::impl::vector_base<_Value_t,_Is_ref>::_Insert'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(991,1): error C3646: 'size_type': unknown override specifier
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(991,1): error C3646: 'Count_generic': unknown override specifier
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(992,3): error C2059: syntax error: '{'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(991,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1010,1): error C2061: syntax error: identifier '_Myarray_t'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1026,1): error C2061: syntax error: identifier 'value_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1038,1): error C2061: syntax error: identifier 'value_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1048,1): error C2061: syntax error: identifier 'value_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1061,1): error C2061: syntax error: identifier 'value_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1072,1): error C2061: syntax error: identifier 'value_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1129,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1149): message : see reference to class template instantiation 'cliext::impl::vector_select<_Value_t,_Is_ref>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1129,1): error C2535: 'cliext::impl::vector_select<_Value_t,_Is_ref>::vector_select(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1112): message : see declaration of 'cliext::impl::vector_select<_Value_t,_Is_ref>::vector_select'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1134,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1134,1): error C2535: 'cliext::impl::vector_select<_Value_t,_Is_ref>::vector_select(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1112): message : see declaration of 'cliext::impl::vector_select<_Value_t,_Is_ref>::vector_select'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1145,1): error C2061: syntax error: identifier '_Myenum_it'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1145,1): error C2535: 'cliext::impl::vector_select<_Value_t,_Is_ref>::vector_select(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1112): message : see declaration of 'cliext::impl::vector_select<_Value_t,_Is_ref>::vector_select'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1194,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1306): message : see reference to class template instantiation 'cliext::impl::vector_select<_Value_t,true>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1194,1): error C2535: 'cliext::impl::vector_select<_Value_t,true>::vector_select(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1177): message : see declaration of 'cliext::impl::vector_select<_Value_t,true>::vector_select'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1199,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1199,1): error C2535: 'cliext::impl::vector_select<_Value_t,true>::vector_select(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1177): message : see declaration of 'cliext::impl::vector_select<_Value_t,true>::vector_select'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1210,1): error C2061: syntax error: identifier '_Myenum_it'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1210,1): error C2535: 'cliext::impl::vector_select<_Value_t,true>::vector_select(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1177): message : see declaration of 'cliext::impl::vector_select<_Value_t,true>::vector_select'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1216,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1223,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1224,1): error C2535: 'void cliext::impl::vector_select<_Value_t,true>::resize(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1216): message : see declaration of 'cliext::impl::vector_select<_Value_t,true>::resize'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1229,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1234,1): error C3646: 'value_type': unknown override specifier
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1234,1): error C3646: 'default': unknown override specifier
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1234,29): error C2143: syntax error: missing ',' before '['
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1234,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1245,1): error C2143: syntax error: missing ')' before ';'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1245,1): error C2059: syntax error: ')'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1245,1): error C2238: unexpected token(s) preceding ';'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1291,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1296,1): error C3646: 'insert': unknown override specifier
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1296,17): error C2059: syntax error: '('
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1297,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1301,1): error C2061: syntax error: identifier 'iterator'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1363,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1395): message : see reference to class template instantiation 'cliext::vector<_Value_t>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1363,1): error C2535: 'cliext::vector<_Value_t>::vector(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1335): message : see declaration of 'cliext::vector<_Value_t>::vector'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1368,1): error C2061: syntax error: identifier 'size_type'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1368,1): error C2535: 'cliext::vector<_Value_t>::vector(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1335): message : see declaration of 'cliext::vector<_Value_t>::vector'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1379,1): error C2061: syntax error: identifier '_Myenum_it'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1379,1): error C2535: 'cliext::vector<_Value_t>::vector(void)': member function already defined or declared
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28117\include\cliext\vector(1335): message : see declaration of 'cliext::vector<_Value_t>::vector'
1>Done building project "test1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
This happens with VS2017, VS2019 and VS2019 preview, all newest versions. I'm so confused. This doesn't seem like a bug since it's rather old and proven headers and happens in different compilers.
edit: super duper complete code here (with project files): https://gist.github.com/s9w/a65bf50ed928bd0d6629c1d10b013463
edit: To help the people from the future with the same problem: It's the /permissive- switch (conformance mode) - doesn't play well with that header.

To help the people from the future with the same problem: It's the /permissive- switch (conformance mode) - doesn't play well with that header.

Related

ATL complains about not including Windows after VS2012 -> VS2017

I'm currently update our projects from VS2012 to VS2017. This has led one project to crash and moan in compilation about ATL.
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(450): error C2143: syntax error: missing ')' before '__stdcall'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(450): error C2143: syntax error: missing ';' before '__stdcall'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(450): error C2059: syntax error: '__stdcall'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(450): error C2059: syntax error: ')'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(451): error C2065: 'PFNMOVEFILETRANSACTED': undeclared identifier
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(451): error C2146: syntax error: missing ';' before identifier 'pfMoveFileTransacted'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(451): error C2065: 'pfMoveFileTransacted': undeclared identifier
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(451): error C2146: syntax error: missing ';' before identifier 'GetProcAddress'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(453): error C2065: 'pfMoveFileTransacted': undeclared identifier
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(455): error C2065: 'pfMoveFileTransacted': undeclared identifier
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(571): error C2143: syntax error: missing ')' before '__stdcall'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(571): error C2143: syntax error: missing ';' before '__stdcall'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(571): error C2059: syntax error: '__stdcall'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(571): error C2059: syntax error: ')'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(572): error C2065: 'PFNFINDFIRSTFILETRANSACTED': undeclared identifier
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(572): error C2146: syntax error: missing ';' before identifier 'pfFindFirstFileTransacted'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(572): error C2065: 'pfFindFirstFileTransacted': undeclared identifier
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(572): error C2146: syntax error: missing ';' before identifier 'GetProcAddress'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(574): error C2065: 'pfFindFirstFileTransacted': undeclared identifier
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(576): error C2065: 'pfFindFirstFileTransacted': undeclared identifier
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(576): error C2065: 'FindExInfoStandard': undeclared identifier
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atltransactionmanager.h(576): error C2065: 'FindExSearchNameMatch': undeclared identifier
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\atlmfc\include\atlcom.h(175): error C2065: 'COINIT_MULTITHREADED': undeclared identifier
1>Done building project "MyProj.vcxproj" -- FAILED.
With error lines such as "undeclared identifier" refers to headers in the windows.h library.
When I include I include through a StdAfx.h which has;
#include <atlbase.h>
#include <atlcom.h>
Regardless where I put Windows.h, the error occurs. I find it likely that it is generated by _WIN32_WINNTstuff but all of that "should" work. Is it deprecated? I don't know... Anyone have any ideas?
In my case there were multiple project including each others stdafx.h headers. This caused the macros to fail/corrupt. Sorting that out and using correct values of WINVER and _WIN32_WINNT fixed it all.
Aside from Alexander's answer make sure that you do NOT define the following:
#define NOTEXTMETRIC

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)

Error linking source file with static library C++

I'm trying to use the static library however when I add the reference and include directories to the project I get strange compiler errors, this including only any header file.
The static library project builds successful. I don't know where the error may be, but I suppose it may be in some file of the static library.
The static library files are the following:
header:
#ifndef UTIL_H_
#define UTIL_H_
#include <string>
#include <iostream>
#include <vector>
#include <stdlib.h>
namespace Kaczmarz {
class Util {
public:
Util();
static void split(std::vector<std::string> &tokens, const std::string &text, char sep);
static double random(int rangeMin,int rangeMax);
virtual ~Util();
};
}
#endif
cpp:
#include "Util.h"
namespace Kaczmarz {
Util::Util() {
// TODO Auto-generated constructor stub
}
void Util::split(std::vector<std::string> &tokens, const std::string &text, char sep) {
unsigned int start = 0, end = 0;
while ((end = text.find(sep, start)) != std::string::npos) {
tokens.push_back(text.substr(start, end - start));
start = end + 1;
}
tokens.push_back(text.substr(start));
}
double Util::random(int rangeMin,int rangeMax){
return (double) static_cast<double>( rand() ) * rangeMax / static_cast<double>( RAND_MAX ) + rangeMin;
}
Util::~Util() {
// TODO Auto-generated destructor stub
}
}
the file that tries to use the static library:
#include <iostream>
using namespace std;
//using namespace Kaczmarz;
int main(){
cout << "Started.." << endl;
return 0;
}
Note that I'm not calling yet any function from the library.
The errors that I got are the following:
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(21): error C2143: syntax error : missing ';' before '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(21): error C2433: 'basic_string' : 'inline' not permitted on data declarations
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(21): error C2988: unrecognizable template declaration/definition
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(21): error C2059: syntax error : '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(38): error C2143: syntax error : missing ';' before '{'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(38): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(49): error C2143: syntax error : missing ';' before '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(49): error C2433: 'basic_string' : 'inline' not permitted on data declarations
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(49): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(49): error C2086: 'int std::basic_string' : redefinition
1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(21) : see declaration of 'std::basic_string'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(49): error C2988: unrecognizable template declaration/definition
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(49): error C2059: syntax error : '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(66): error C2143: syntax error : missing ';' before '{'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(66): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(77): error C2143: syntax error : missing ';' before '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(77): error C2433: 'basic_string' : 'inline' not permitted on data declarations
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(77): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(77): error C2086: 'int std::basic_string' : redefinition
1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(21) : see declaration of 'std::basic_string'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(77): error C2988: unrecognizable template declaration/definition
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(77): error C2059: syntax error : '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(94): error C2143: syntax error : missing ';' before '{'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(94): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(101): error C2143: syntax error : missing ';' before '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(101): error C2433: 'basic_string' : 'inline' not permitted on data declarations
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(101): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(101): error C2086: 'int std::basic_string' : redefinition
1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(21) : see declaration of 'std::basic_string'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(101): error C2988: unrecognizable template declaration/definition
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(101): error C2059: syntax error : '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(114): error C2143: syntax error : missing ';' before '{'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(114): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(125): error C2143: syntax error : missing ';' before '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(125): error C2433: 'basic_string' : 'inline' not permitted on data declarations
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(125): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(125): error C2086: 'int std::basic_string' : redefinition
1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(21) : see declaration of 'std::basic_string'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(125): error C2988: unrecognizable template declaration/definition
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(125): error C2059: syntax error : '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(138): error C2143: syntax error : missing ';' before '{'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(138): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(145): error C2143: syntax error : missing ';' before '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(145): error C2433: 'basic_string' : 'inline' not permitted on data declarations
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(145): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(145): error C2086: 'int std::basic_string' : redefinition
1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(21) : see declaration of 'std::basic_string'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(145): error C2988: unrecognizable template declaration/definition
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(145): error C2059: syntax error : '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(158): error C2143: syntax error : missing ';' before '{'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(158): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(166): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(166): error C2143: syntax error : missing ',' before '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(170): error C2803: 'operator ==' must have at least one formal parameter of class type
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(170): error C2805: binary 'operator ==' has too few parameters
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(177): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(177): error C2143: syntax error : missing ',' before '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(180): error C2803: 'operator ==' must have at least one formal parameter of class type
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(186): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(186): error C2143: syntax error : missing ',' before '<'
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(190): fatal error C1903: unable to recover from previous error(s); stopping compilation
Note that the errors mention the std string class.
Since it's Christmas time and I see that you're using MSVS, here are steps that I did to try your library:
Step 1: I have created new solution called XmasTest with new Win32 project in it called XmasLib.
Step 2: I have added your source files in that project, just a simple example-appropriate modification. I have even let that evil using namespace std; line in the header file.
Util.h
#ifndef UTIL_H_
#define UTIL_H_
#include <string>
#include <iostream>
#include <vector>
#include <stdlib.h>
using namespace std;
namespace Kaczmarz {
class Util {
public:
Util();
static void print();
virtual ~Util();
};
} /* namespace Kaczmarz */
#endif
Util.cpp
#include "Util.h"
using namespace std;
namespace Kaczmarz {
Util::Util() {
// TODO Auto-generated constructor stub
}
void Util::print() {
cout << "Util::print() works! yay!" << endl;
}
Util::~Util() {
}
} /* namespace Kaczmarz */
Step 3: I have created new Win32 Console application called XmasLibTestApp with following code in it:
#include <iostream>
#include "../XmasLib/Util.h"
using namespace std;
using namespace Kaczmarz;
int main(){
Util u;
u.print();
return 0;
}
Step 4: Since these are 2 projects within 1 solution, I have handled the dependency in the following way:
Linker->General->Additional Library Directories: $(OutDir)
Linker->Input->Additional Dependencies: XmasLib.lib
Solution Properties->ProjectDependencies: App depends on lib
Step 5: Build Solution and run app. Output: Util::print() works! yay!
And that's it. End of the story, everything works, developer rejoices with his IDE.
Happy Xmas! :D
PS: Questions that are worth to have a look at:
Why is "using namespace std" considered bad practice?
What requires me to declare "using namespace std;"?
where to put using namespace std;
Ok found the cause of this compiling errors.
In the "additional include directories" (vs 2012) I had another .cpp/.h files which imported "Util" class.
I just removed this files from the directory and this time it compiled good without any errors. Note that this files weren't present in the project (I had excluded them), however seems that "additional include directories" linked them somehow in the project.
Thanks to all who have answered, I really appreciate it.

Compiling error in C++ project with C and C++ codes

I've created a C++ project where I use C and C++ codes and have some problems with headers...
OK, I have 3 codes:
basicOCR.cpp
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "preprocessing.h"
#include "basicOCR.h"
preprocessing.c
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include "preprocessing.h"
main.c
#include <stdio.h>
#include <ctype.h>
#include "basicOCR.h"
and my 2 own header files:
basicOCR.h
#include <stdio.h>
#include <ctype.h>
preprocessing.h
#include <stdio.h>
#include <ctype.h>
Whenever I try to compile a project, it compiles basicOCR.cpp without any problems but preprocessing.c and main.c give me syntax errors in cstdlib and xstddef. I know that they are C++ libraries. I read this How to mix C and C++
and tried almost everything but it didn't work.
1> preprocessing.c
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(19): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(19): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(19): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2061: syntax error : identifier 'abs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2061: syntax error : identifier 'atexit'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2061: syntax error : identifier 'atof'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2061: syntax error : identifier 'atoi'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2061: syntax error : identifier 'atol'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2061: syntax error : identifier 'bsearch'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2061: syntax error : identifier 'calloc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2061: syntax error : identifier 'div'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2061: syntax error : identifier 'exit'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2061: syntax error : identifier 'free'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2061: syntax error : identifier 'getenv'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2061: syntax error : identifier 'labs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2061: syntax error : identifier 'ldiv'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2061: syntax error : identifier 'malloc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2061: syntax error : identifier 'mblen'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2061: syntax error : identifier 'mbstowcs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2061: syntax error : identifier 'mbtowc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2061: syntax error : identifier 'qsort'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2061: syntax error : identifier 'rand'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2061: syntax error : identifier 'realloc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2061: syntax error : identifier 'srand'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2061: syntax error : identifier 'strtod'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2061: syntax error : identifier 'strtol'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2061: syntax error : identifier 'strtoul'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2061: syntax error : identifier 'system'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2061: syntax error : identifier 'wcstombs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2061: syntax error : identifier 'wctomb'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(32): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(34): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(34): error C2061: syntax error : identifier 'lldiv'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(34): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstddef(18): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstddef(18): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(78): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(78): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(87): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(87): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(98): error C2061: syntax error : identifier 'tr1'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(98): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(98): error C2449: found '{' at file scope (missing function header?)
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(101): error C2059: syntax error : '}'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(125): error C2143: syntax error : missing '{' before ':'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(125): error C2059: syntax error : ':'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(132): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(132): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(141): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(141): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\eh.h(27): fatal error C1189: #error : "eh.h is only for C++!"
1> main.c
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(19): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(19): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(19): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2061: syntax error : identifier 'abs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2061: syntax error : identifier 'atexit'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2061: syntax error : identifier 'atof'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2061: syntax error : identifier 'atoi'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2061: syntax error : identifier 'atol'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2061: syntax error : identifier 'bsearch'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2061: syntax error : identifier 'calloc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2061: syntax error : identifier 'div'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2061: syntax error : identifier 'exit'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2061: syntax error : identifier 'free'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2061: syntax error : identifier 'getenv'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2061: syntax error : identifier 'labs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2061: syntax error : identifier 'ldiv'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2061: syntax error : identifier 'malloc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2061: syntax error : identifier 'mblen'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2061: syntax error : identifier 'mbstowcs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2061: syntax error : identifier 'mbtowc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2061: syntax error : identifier 'qsort'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2061: syntax error : identifier 'rand'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2061: syntax error : identifier 'realloc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2061: syntax error : identifier 'srand'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2061: syntax error : identifier 'strtod'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2061: syntax error : identifier 'strtol'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2061: syntax error : identifier 'strtoul'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2061: syntax error : identifier 'system'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2061: syntax error : identifier 'wcstombs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2061: syntax error : identifier 'wctomb'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(32): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(34): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(34): error C2061: syntax error : identifier 'lldiv'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(34): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstddef(18): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstddef(18): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(78): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(78): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(87): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(87): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(98): error C2061: syntax error : identifier 'tr1'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(98): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(98): error C2449: found '{' at file scope (missing function header?)
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(101): error C2059: syntax error : '}'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(125): error C2143: syntax error : missing '{' before ':'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(125): error C2059: syntax error : ':'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(132): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(132): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(141): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(141): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\eh.h(27): fatal error C1189: #error : "eh.h is only for C++!"
I got that. 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)
It looks like vc use c++ headers for c code.
This does not answer the question, but why not just use C++? The only time you need C is when you want to be compatible with different versions of different compilers, which happens when you build a plug-in architecture. In this case you declare plug-in prototypes in a "SDK" header like this:
#ifndef __SDK_H
#define __SDK_H
#ifdef __cplusplus
extern "C"
{
#endif
__declspec(dllexport) return_type calling_convention function_name(parameters);
#ifdef __cplusplus
}
#endif
#endif
Then you can compile your plugin.c which should contain the following:
#include "sdk.h"
return_type function_name(parameters)
{
/*Do stuff here*/
}

Replacing native VS 2010 (VC10) tr1 libraries with Boost.TR1

I have been using VS 2005 (VC8) with Boost.TR1 in the std::tr1 namespace by setting the Include Directories of VS to prioritize the boost tr1 headers as described here.
Now I am moving over to VS 2010 (VC10) and I seem to be getting compilation errors using the same include method.
The Include Directories are set to:
[boost-root]\boost\tr1\tr1
[boost-root]
VC standard include directories
Sample code:
#include <functional>
#include <iostream>
int main(int argc, char ** argv)
{
std::cout << std::tr1::bind(std::minus<int>(), 5, std::tr1::placeholders::_1)(5)
<< std::endl;
return 0;
}
Build output:
1>------ Rebuild All started: Project: test_tr1, Configuration: Release Win32 ------
1>Build started 17/8/2010 1:01:58 PM.
1>_PrepareForClean:
1> Deleting file "Release\test_tr1.lastbuildstate".
1>InitializeBuildStatus:
1> Creating "Release\test_tr1.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> main.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(26): error C2143: syntax error : missing ';' before '<'
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(27) : see reference to class template instantiation 'std::tr1::_Unrefwrap<_Type>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(26): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(26): error C2238: unexpected token(s) preceding ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(84): error C2039: '_Remove_reference' : is not a member of 'std::tr1'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(84): error C2143: syntax error : missing ';' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(84): error C2433: '_Remove_reference' : 'inline' not permitted on data declarations
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(84): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(84): error C2988: unrecognizable template declaration/definition
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(84): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(84): error C2039: '_Type' : is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(92): error C2039: '_Remove_reference' : is not a member of 'std::tr1'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(92): error C2039: '_Type' : is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(94): error C2143: syntax error : missing ';' before '{'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(94): error C2447: '{' : missing function header (old-style formal list?)
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(139): error C2143: syntax error : missing ';' before '<'
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(168) : see reference to class template instantiation 'std::_Pair_base<_Ty1,_Ty2>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(139): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(139): error C2238: unexpected token(s) preceding ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(140): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(140): error C2238: unexpected token(s) preceding ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(142): error C2061: syntax error : identifier '_Ty1x'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(142): error C2535: 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base(void)' : member function already defined or declared
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(124) : see declaration of 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(148): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(148): error C2143: syntax error : missing ',' before '&'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(153): error C2061: syntax error : identifier '_Ty1x'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(153): error C2535: 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base(void)' : member function already defined or declared
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(124) : see declaration of 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(221): error C2059: syntax error : '<'
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(273) : see reference to class template instantiation 'std::pair<_Ty1,_Ty2>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(221): error C2238: unexpected token(s) preceding ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(222): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(222): error C2238: unexpected token(s) preceding ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(224): error C2061: syntax error : identifier '_Ty1x'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(224): error C2535: 'std::pair<_Ty1,_Ty2>::pair(void)' : member function already defined or declared
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(181) : see declaration of 'std::pair<_Ty1,_Ty2>::pair'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(230): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(230): error C2143: syntax error : missing ',' before '&'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(236): error C2061: syntax error : identifier '_Ty1x'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(236): error C2535: 'std::pair<_Ty1,_Ty2>::pair(void)' : member function already defined or declared
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/utility(181) : see declaration of 'std::pair<_Ty1,_Ty2>::pair'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(282): error C2143: syntax error : missing ',' before '<'
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(284) : see reference to class template instantiation 'std::_Is_checked_helper<_Iter>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(500): error C2143: syntax error : missing ';' before '<'
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(504) : see reference to class template instantiation 'std::_Ptr_cat_helper<_Elem,_Elem>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(500): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(503): error C2238: unexpected token(s) preceding ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(345): error C2143: syntax error : missing ';' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(345): error C2433: 'enable_if' : 'inline' not permitted on data declarations
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(345): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(345): error C2988: unrecognizable template declaration/definition
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(345): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(345): error C2039: 'value' : is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(346): error C2065: '_Ret' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(347): error C2065: '_Rx' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(348): error C2143: syntax error : missing ')' before '__cdecl'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(348): error C3861: '_Rx': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(349): error C2039: 'type' : is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(360): error C2065: '_Rx' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(361): error C2065: '_Rx' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(362): error C2143: syntax error : missing ')' before '__cdecl'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(362): error C3861: '_Rx': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(364): error C2143: syntax error : missing ';' before '{'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(365): error C2143: syntax error : missing ')' before '__cdecl'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(365): error C3861: '_Rx': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(366): error C2065: '_Callable' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(367): error C2065: '_Rx' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(367): error C2065: '_Rx' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(367): error C2065: '_MyBind' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(368): error C2143: syntax error : missing ';' before '}'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(374): error C2947: expecting '>' to terminate template-argument-list, found '>'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(375): error C2039: 'value' : is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(375): error C2065: 'value' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(375): error C2275: 'std::tr1::_Rx' : illegal use of this type as an expression
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(374) : see declaration of 'std::tr1::_Rx'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(376): error C2065: '_Ret' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(379): error C2947: expecting '>' to terminate template-argument-list, found '>'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(379): error C2974: 'std::tr1::_Callable_fun' : invalid template argument for '_Ty', type expected
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xrefwrap(185) : see declaration of 'std::tr1::_Callable_fun'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(379): error C2975: 'std::tr1::_Callable_fun' : invalid template argument for '_Indirect', expected compile-time constant expression
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xrefwrap(185) : see declaration of 'std::tr1::_Callable_fun'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(380): error C2039: 'type' : is not a member of 'std::tr1::_Callable_fun'
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xrefwrap(185) : see declaration of 'std::tr1::_Callable_fun'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(380): error C2065: 'type' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(380): error C2146: syntax error : missing ',' before identifier 'bind'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(380): error C2143: syntax error : missing ')' before '__stdcall'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(380): error C2514: 'std::tr1::_Rx' : class has no constructors
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(374) : see declaration of 'std::tr1::_Rx'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(381): error C2143: syntax error : missing ';' before '{'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(383): error C2065: '_Callable' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(384): error C2065: '_Ret' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(384): error C2065: '_MyBind' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(385): error C2143: syntax error : missing ';' before '}'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(394): error C2143: syntax error : missing ';' before '{'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(396): error C2065: '_Callable' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(397): error C2065: '_MyBind' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(398): error C2143: syntax error : missing ';' before '}'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(404): error C2947: expecting '>' to terminate template-argument-list, found '>'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(405): error C2146: syntax error : missing ',' before identifier 'enable_if'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(405): error C2065: 'is_same' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(405): error C2065: '_Ret' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(405): error C2039: 'value' : is not a member of 'std::tr1::_Bind'
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/functional(380) : see declaration of 'std::tr1::_Bind'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(406): error C2065: '_Ret' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(409): error C2955: 'std::tr1::_Bind' : use of class template requires template argument list
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\../include/functional(380) : see declaration of 'std::tr1::_Bind'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(410): error C2039: 'type' : is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(410): error C2065: 'type' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(410): error C2146: syntax error : missing ',' before identifier 'bind'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(410): error C2143: syntax error : missing ')' before '__fastcall'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(410): error C2514: 'std::tr1::_Rx' : class has no constructors
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(374) : see declaration of 'std::tr1::_Rx'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(410): error C2059: syntax error : ')'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(411): error C2143: syntax error : missing ';' before '{'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(413): error C2065: '_Callable' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(414): error C2065: '_Ret' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(414): error C2065: '_MyBind' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(415): error C2143: syntax error : missing ';' before '}'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(424): error C2143: syntax error : missing ';' before '{'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(426): error C2065: '_Callable' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(427): error C2065: '_MyBind' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(428): error C2143: syntax error : missing ';' before '}'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(240): error C2906: 'std::tr1::_Binder<false,1>' : explicit specialization requires 'template <>'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(257): error C2947: expecting '>' to terminate template-argument-list, found '>'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxbind1(257): fatal error C1003: error count exceeds 100; stopping compilation
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.48
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
It seems like it is using VC10's tr1 headers instead of boost. What is the correct method to get VS to use Boost.TR1 as a replacement?
Try defining _HAS_CPP0X=0 in the project's set of defines - that's supposed to disable VC10's TR1 support.
Microsoft advises against using _HAS_CPP0X=0 with VS2010. What you can do is:
Use Microsoft's tr1 implementation (not recommended, it's buggy)
Use the boost tr1 features directly from the boost namespace using full qualifiers (e.g. boost::function(..), boost::bind(...), etc.). You get name clashes otherwise.
Use using-declarations