This program compiles and runs on TC++ 3.0.
Why don't this program compile in VC++2008Express?
#include <iostream>
using namespace std;
class MyClass
{
private:
class MyNestedClass
{
private:
int myInteger;
public:
MyNestedClass(int a)
{
myInteger = a;
}
void Show()
{
cout<<myInteger;
}
};
};
int main()
{
MyClass::MyNestedClass myNestedClassObject(100);
myNestedClassObject.Show();
}
The following messages are shown:
1>------ Rebuild All started: Project: Test, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'Test', configuration 'Debug|Win32'
1>Compiling...
1>Static_Data_Member.c
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(39) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(39) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(41) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(41) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(41) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(41) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(41) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(41) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(42) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(42) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(42) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(42) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(42) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(42) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(43) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(43) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(43) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(43) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(43) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(43) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(44) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(44) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(44) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(44) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(44) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(44) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(45) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(45) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(45) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(45) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(45) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(45) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(46) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(46) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(46) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(46) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(46) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(46) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(47) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(47) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(47) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(47) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(47) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(47) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(48) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(48) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(48) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(48) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(48) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(48) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(49) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(49) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(49) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(49) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(50) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(50) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(50) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(50) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(51) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(51) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(51) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(51) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(51) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(51) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(52) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(52) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(52) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(52) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(52) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(52) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(53) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(53) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(53) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(53) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(53) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(53) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(54) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(54) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(54) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(54) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(54) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(54) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(55) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(55) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(55) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(55) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(55) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(55) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(56) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdio(56) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdlib(21) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdlib(21) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdlib(21) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdlib(21) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdlib(21) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdlib(21) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdlib(23) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdlib(23) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdlib(23) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdlib(23) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdlib(23) : error C2143: syntax error : missing '{' before ':'
1>c:\program files\microsoft visual studio 9.0\vc\include\cstdlib(23) : fatal error C1003: error count exceeds 100; stopping compilation
1>Build log was saved at "file://h:\Test\Debug\BuildLog.htm"
1>Test - 102 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
This is a C++ program, but you've given your source file a .c extension.
By default, the Visual C++ compiler compiles .c files as C. Use a .cpp extension or compile with the /TP flag to compile the source as C++.
However, even if you compile the source as C++, the program is still invalid. MyNestedClass is a private member type of MyClass, so you cannot construct an instance of it in main().
Related
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
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)
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*/
}
Errors:
1>------ Build started: Project: alglibTest, Configuration: Debug Win32 ------
1>Build started 5/22/2011 12:52:26 PM.
1>InitializeBuildStatus:
1> Touching "Debug\alglibTest.unsuccessfulbuild".
1>ClCompile:
1> main.cpp
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(38): error C2054: expected '(' to follow 'using'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(40): error C2061: syntax error : identifier 'using'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(40): error C2054: expected '(' to follow 'using'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(40): error C2061: syntax error : identifier 'using'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(41): error C2061: syntax error : identifier 'clearerr'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(41): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(41): error C2061: syntax error : identifier 'fclose'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(41): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(41): error C2061: syntax error : identifier 'feof'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(41): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(42): error C2061: syntax error : identifier 'ferror'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(42): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(42): error C2061: syntax error : identifier 'fflush'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(42): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(42): error C2061: syntax error : identifier 'fgetc'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(42): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(43): error C2061: syntax error : identifier 'fgetpos'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(43): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(43): error C2061: syntax error : identifier 'fgets'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(43): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(43): error C2061: syntax error : identifier 'fopen'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(43): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(44): error C2061: syntax error : identifier 'fprintf'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(44): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(44): error C2061: syntax error : identifier 'fputc'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(44): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(44): error C2061: syntax error : identifier 'fputs'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(44): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(45): error C2061: syntax error : identifier 'fread'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(45): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(45): error C2061: syntax error : identifier 'freopen'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(45): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(45): error C2061: syntax error : identifier 'fscanf'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(45): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(46): error C2061: syntax error : identifier 'fseek'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(46): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(46): error C2061: syntax error : identifier 'fsetpos'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(46): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(46): error C2061: syntax error : identifier 'ftell'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(46): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(47): error C2061: syntax error : identifier 'fwrite'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(47): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(47): error C2061: syntax error : identifier 'getc'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(47): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(47): error C2061: syntax error : identifier 'getchar'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(47): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(48): error C2061: syntax error : identifier 'gets'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(48): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(48): error C2061: syntax error : identifier 'perror'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(48): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(49): error C2061: syntax error : identifier 'putc'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(49): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(49): error C2061: syntax error : identifier 'putchar'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(49): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(50): error C2061: syntax error : identifier 'printf'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(50): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(50): error C2061: syntax error : identifier 'puts'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(50): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(50): error C2061: syntax error : identifier 'remove'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(50): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(51): error C2061: syntax error : identifier 'rename'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(51): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(51): error C2061: syntax error : identifier 'rewind'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(51): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(51): error C2061: syntax error : identifier 'scanf'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(51): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(52): error C2061: syntax error : identifier 'setbuf'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(52): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(52): error C2061: syntax error : identifier 'setvbuf'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(52): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(52): error C2061: syntax error : identifier 'sprintf'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(52): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(53): error C2061: syntax error : identifier 'sscanf'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(53): error C2059: syntax error : ';'
1 >c:\program files\microsoft visual studio 10.0\vc\include\cstdio(53): error C2061: syntax error : identifier 'tmpfile'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(53): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(53): error C2061: syntax error : identifier 'tmpnam'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(53): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(54): error C2061: syntax error : identifier 'ungetc'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(54): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(54): error C2061: syntax error : identifier 'vfprintf'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(54): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(54): error C2061: syntax error : identifier 'vprintf'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(54): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(55): error C2061: syntax error : identifier 'vsprintf'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdio(55): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(19): error C2054: expected '(' to follow 'using'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(19): error C2061: syntax error : identifier 'using'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(19): error C2054: expected '(' to follow 'using'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(21): error C2061: syntax error : identifier 'using'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(21): error C2061: syntax error : identifier 'abs'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(21): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(21): error C2061: syntax error : identifier 'atexit'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(21): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(22): error C2061: syntax error : identifier 'atof'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(22): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(22): error C2061: syntax error : identifier 'atoi'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(22): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(22): error C2061: syntax error : identifier 'atol'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(22): error C2059: syntax error : ';'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(23): error C2061: syntax error : identifier 'bsearch'
1>c:\program files\microsoft visual studio 10.0\vc\include\cstdlib(23): fatal error C1003: error count exceeds 100; stopping compilation
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.57
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What can I do about it?
This usually happens when you are trying to compile C code with C++ headers. If you want to compile C code, change C++ headers to C headers (cstdio to stdio.h, cstdlib to stdlib.h), if you want to compile C++ code, change your project settings (Configuration Properties -> C/C++ -> Advanced -> Compile As C++ code).
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