VS 2010 Compile error in SDK include headers - c++

I had one problem when compiling code with VS2010. I got the following 100+ errors with the SDK headers. When I compiled the exact same code with VS2013 and V120, it worked fine.
I found similar problem on following link but it didn't work.
[Visual Studio 2010 and windows SDK 7.0a compilation error
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h(5472): error C2061: syntax error : identifier 'BSTR'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h(5497): error C2061: syntax error : identifier 'BSTR'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h(5507): error C2061: syntax error : identifier 'BSTR'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h(5525): error C2061: syntax error : identifier 'BSTR'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h(5544): error C2061: syntax error : identifier 'BSTR'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h(5569): error C2061: syntax error : identifier 'BSTR'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h(5579): error C2061: syntax error : identifier 'BSTR'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(303): error C2146: syntax error : missing ';' before identifier '_pchBuf'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(303): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(303): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(306): error C2146: syntax error : missing ';' before identifier '_pszFound'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(306): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(306): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(307): error C2146: syntax error : missing ';' before identifier '_pszExpected'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(307): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(307): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(410): error C2061: syntax error : identifier 'BSTR'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(535): error C2061: syntax error : identifier 'BSTR'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(596): error C2061: syntax error : identifier 'BSTR'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(599): error C2061: syntax error : identifier 'BSTR'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\msxml.h(602): error C2061: syntax error : identifier 'BSTR'
For Jonathan's question, the include part in the main cpp is as the following:
// Defines the entry point for the console application.
//
#include "stdafx.h"
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <math.h>
//----------------------------------------------------------------------------------
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <afx.h>
#include <time.h>
#include <stdlib.h>
#include <map>
#include <direct.h>
// insert specific include here
#include "recordSet.h"
#define roundX(x) ( floor(100.0 * x + 0.49 )) / 100 ;
#include "OutputAccumulator.h"
using namespace std;
Here is the code of stdfax.h:
#pragma warning(disable : 4786)
#if !defined(AFX_STDAFX_H__25F9CFE5_5C52_11D5_98E7_000255667102__INCLUDED_)
#define AFX_STDAFX_H__25F9CFE5_5C52_11D5_98E7_000255667102__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afx.h>
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdao.h> // MFC DAO database classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <iostream>
#define VERY_SMALL_VALUE 0.0000001
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__25F9CFE5_5C52_11D5_98E7_000255667102__INCLUDED_)
Thanks for any insight!

Related

Get massive compile error whenever windows.h is included, my environment is visual studio 2013 in win 7

I have a CPP file Log.cpp which has one line code:
#include "windows.h"
When I compile it, massive syntax errors display:
1>------ Build started: Project: topx, Configuration: Debug Win32 ------
1> Log.cpp
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(936): error C2065: 'hMem' : undeclared identifier
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(936): error C2065: 'dwBytes' : undeclared identifier
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(938): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(938): error C2491: '_Ret_reallocated_bytes_' : definition of dllimport data not allowed
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(938): error C2078: too many initializers
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(938): error C2146: syntax error : missing ';' before identifier 'HGLOBAL'
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(938): error C2143: syntax error : missing ';' before '__stdcall'
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(938): error C2377: 'HGLOBAL' : redefinition; typedef cannot be overloaded with any other symbol
1> c:\program files (x86)\windows kits\8.0\include\shared\minwindef.h(211) : see declaration of 'HGLOBAL'
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(940): error C2146: syntax error : missing ')' before identifier 'hMem'
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(940): warning C4229: anachronism used : modifiers on data are ignored
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(940): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(943): error C2059: syntax error : ')'
....
....
But all is OK when I compile it under windows 8, what is the problem?
Change from:
C:\Program Files (x86)\Windows Kits\8.0\Include\shared
to
C:\Program Files (x86)\Windows Kits\8.1\Include\shared
in "Additional include directories" of project resolve this problem, but I do not know why.

#include <windows.h> causes a lot of syntax errors

My program uses Qt and OpenGL. It compiles correctly under Linux and Mac.
When compiled on windows, I need to #include windows.h in order to use OpenGL, the code is like following,
#if defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64)
#include <windows.h>
#endif
#ifdef __APPLE__
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#else
#include <GL/glu.h>
#include <GL/glut.h>
#endif
However, there are a lot of error messages like
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(167) : error C2146: syntax error : missing ')' before identifier 'PRPC_MESSAGE'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(167) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(167) : error C2513: 'void *' : no variable declared before '='
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(167) : error C2440: 'initializing' : cannot convert from 'std::ostream' to 'void *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(168) : error C2059: syntax error : ')'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(226) : error C2146: syntax error : missing ')' before identifier 'RPC_MESSAGE'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(226) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(226) : error C2491: 'I_RpcNegotiateTransferSyntax' : definition of dllimport data not allowed
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(227) : error C2059: syntax error : ')'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(235) : error C2146: syntax error : missing ')' before identifier 'RPC_MESSAGE'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(235) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(235) : error C2491: 'I_RpcGetBuffer' : definition of dllimport data not allowed
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(236) : error C2059: syntax error : ')'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(242) : error C2146: syntax error : missing ')' before identifier 'RPC_MESSAGE'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(242) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(242) : error C2491: 'I_RpcGetBufferWithObject' : definition of dllimport data not allowed
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(244) : error C2059: syntax error : ')'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(251) : error C2146: syntax error : missing ')' before identifier 'RPC_MESSAGE'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(251) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(251) : error C2491: 'I_RpcSendReceive' : definition of dllimport data not allowed
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(252) : error C2059: syntax error : ')'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(259) : error C2146: syntax error : missing ')' before identifier 'RPC_MESSAGE'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(259) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(259) : error C2491: 'I_RpcFreeBuffer' : definition of dllimport data not allowed
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(260) : error C2059: syntax error : ')'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(267) : error C2146: syntax error : missing ')' before identifier 'PRPC_MESSAGE'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(267) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(267) : error C2491: 'I_RpcSend' : definition of dllimport data not allowed
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(268) : error C2059: syntax error : ')'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(275) : error C2146: syntax error : missing ')' before identifier 'PRPC_MESSAGE'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(275) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(275) : error C2491: 'I_RpcReceive' : definition of dllimport data not allowed
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(277) : error C2059: syntax error : ')'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(284) : error C2146: syntax error : missing ')' before identifier 'RPC_MESSAGE'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(284) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(284) : error C2491: 'I_RpcFreePipeBuffer' : definition of dllimport data not allowed
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(285) : error C2059: syntax error : ')'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(302) : error C2146: syntax error : missing ')' before identifier 'I_RPC_MUTEX'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(302) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(302) : error C2182: 'I_RpcRequestMutex' : illegal use of type 'void'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(302) : error C2491: 'I_RpcRequestMutex' : definition of dllimport data not allowed
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(303) : error C2059: syntax error : ')'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(438) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(453) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(479) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(487) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(534) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(542) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(728) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(744) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(754) : error C2146: syntax error : missing ')' before identifier 'UUID'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(754) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(754) : error C2491: 'I_UuidCreate' : definition of dllimport data not allowed
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(755) : error C2059: syntax error : ')'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(763) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(771) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(779) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(838) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(848) : error C2061: syntax error : identifier 'cout'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(873) : error C2144: syntax error : 'unsigned long' should be preceded by ')'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(873) : error C2448: 'I_RpcConnectionInqSockBuffSize' : function-style initializer appears to be a function definition
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(874) : error C2144: syntax error : 'unsigned long' should be preceded by ';'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcdcep.h(874) : fatal error C1903: unable to recover from previous error(s); stopping compilation
If I don't #include windows.h, then those errors will not appear.
I am using VS2013 with Qt 5.3.
OpenGL on Microsoft Windows is tied to WGL, which is in turn tied to GDI.
As a result, you cannot #include <gl/gl.h> (you are indirectly doing this by including <GL/glu.h>) without first including some Windows-specific header that defines GDI/Windows pre-processor tokens such as WINGDIAPI and APIENTRY. But that is actually the extent to which any OpenGL program on Windows is tied to anything Windows-specific (header wise).
WinDef.h defines APIENTRY and WinGDI.h defines WINGDIAPI - including Windows.h brings in both of those headers (and a lot of other garbage unfortunately). So including Windows.h is mostly a convenience; to minimally compile OpenGL software on Windows you should #include <WinDef.h> followed by #include <WinGDI.h> and then finally #include <GL/gl.h>.
Alternatively, you can #define WIN32_LEAN_AND_MEAN just prior to #include <Windows.h> and it will significantly reduce the number of unrelated things that are brought in by including that header. Many Visual C++ projects actually define that pre-processor definition by default when they are first created, you might want to see if your project is configured that way.
windows.h clutter the global namespace with tons of bad things like ERROR, Rectangle ...
One way around the problem is to declare needed functions your self (I guess this is not too mutch work since you will not need more than 10 functions or so). You can call the include file wgl.h or something.
__declspec(dllimport) void* __stdcall wglCreateContext(void* hdc);
//... Other functions you need
The OpenGL API is defined outside windows.h so no problem there

Visual Studio include files calling error - C++

I'm building one sample from CEGUI, the SDK seems to be fine setle and the futher errors regarding the CEGUI on the log seems to come because of the errors with the includes from MVS. I can't affirm this since I'm not a C++ expert yet...I'm more experienced with Java..
Anyway, I saw a lot of posts talking about those compile errors, even since 2005, but some of them are just threw away, descontinued or the others that has an answer I couldn't fully understand (I supose until now they dont fit on my case...).
I can list here some posts I tryed to find an answer:
http://www.ogre3d.org/forums/viewtopic.php?p=205194
error C2039: 'find' : is not a member of 'std'
error C2039: 'memchr' : is not a member of '`global namespace''
Syntax Errors in standard Microsoft files "iosfwd" & "atlconv.h" while compiling a VS2008 soln?
I don't really get whats going wrong on my programm, so I'm seeking for help here cos I've been stuck here for 2 days reading things and trying to solve my own, I don't know what else to do to go futher. Could someone try to explain me what might be wrong with the compilation?
1>------ Build started: Project: Almost giving up, Configuration: Debug Win32 ------
1> main.cpp
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\iosfwd(517): error C2039: 'memcmp' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\iosfwd(517): error C3861: 'memcmp': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\iosfwd(523): error C2039: 'strlen' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\iosfwd(523): error C3861: 'strlen': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\iosfwd(546): error C2039: 'memchr' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\iosfwd(546): error C3861: 'memchr': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\iosfwd(559): error C2039: 'memset' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\iosfwd(559): error C3861: 'memset': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2651): error C2039: 'memset' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2651): error C3861: 'memset': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2656): error C2039: 'memset' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2656): error C3861: 'memset': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2661): error C2039: 'memset' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2661): error C3861: 'memset': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2685): error C2039: 'memset' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2685): error C3861: 'memset': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2692): error C2039: 'memset' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2692): error C3861: 'memset': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2699): error C2039: 'memset' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2699): error C3861: 'memset': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2964): error C2039: 'memcmp' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2964): error C3861: 'memcmp': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2970): error C2039: 'memcmp' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2970): error C3861: 'memcmp': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2976): error C2039: 'memcmp' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2976): error C3861: 'memcmp': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(3125): error C2039: 'memcmp' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(3125): error C3861: 'memcmp': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(3193): error C2039: 'memchr' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(3193): error C3861: 'memchr': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(3200): error C2039: 'memchr' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(3200): error C3861: 'memchr': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(3208): error C2039: 'memchr' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(3208): error C3861: 'memchr': identifier not found
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(44): error C2146: syntax error : missing ';' before identifier 'utf8'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(44): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(46): error C2146: syntax error : missing ';' before identifier 'utf32'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(46): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(51): error C2146: syntax error : missing ';' before identifier 'encoded_char'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(51): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(51): error C2378: 'CEGUI::utf8' : redefinition; symbol cannot be overloaded with a typedef
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(44) : see declaration of 'CEGUI::utf8'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(64): error C2504: 'AllocatedObject' : base class undefined
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(64): error C2143: syntax error : missing ',' before '<'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(70): error C2146: syntax error : missing ';' before identifier 'value_type'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(70): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(87): error C2143: syntax error : missing ';' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(87): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(471): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(471): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(503): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(503): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(503): error C2535: 'CEGUI::String::String(const int)' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(471) : see declaration of 'CEGUI::String::String'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(862): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(862): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(897): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(897): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(935): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(935): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(936): error C2535: 'int CEGUI::String::compare(CEGUI::String::size_type,CEGUI::String::size_type,const int) const' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(897) : see declaration of 'CEGUI::String::compare'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1082): error C2143: syntax error : missing ';' before '['
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1082): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1083): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1162): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1162): error C2143: syntax error : missing ';' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1163): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1165): warning C4183: 'data': missing return type; assumed to be a member function returning 'int'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1207): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1207): error C2061: syntax error : identifier 'utf8'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1381): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1381): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1381): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1404): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1404): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1404): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1430): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1430): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1430): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1431): error C2535: 'CEGUI::String &CEGUI::String::assign(const int)' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1404) : see declaration of 'CEGUI::String::assign'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1454): error C2535: 'CEGUI::String &CEGUI::String::operator =(const int)' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1381) : see declaration of 'CEGUI::String::operator ='
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1728): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1728): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1728): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1751): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1751): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1751): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1778): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1778): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1778): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1779): error C2535: 'CEGUI::String &CEGUI::String::append(const int)' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1751) : see declaration of 'CEGUI::String::append'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1807): error C2535: 'CEGUI::String &CEGUI::String::operator +=(const int)' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(1728) : see declaration of 'CEGUI::String::operator +='
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2115): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2115): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2145): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2145): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2146): error C2535: 'CEGUI::String &CEGUI::String::insert(CEGUI::String::size_type,const int)' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2115) : see declaration of 'CEGUI::String::insert'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2747): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2747): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2779): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2779): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2812): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2812): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2813): error C2535: 'CEGUI::String &CEGUI::String::replace(CEGUI::String::size_type,CEGUI::String::size_type,const int)' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2747) : see declaration of 'CEGUI::String::replace'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2867): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2867): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2868): error C2535: 'CEGUI::String &CEGUI::String::replace(CEGUI::String::iterator,CEGUI::String::iterator,const int)' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(2779) : see declaration of 'CEGUI::String::replace'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3388): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3388): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3388): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3415): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3415): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3415): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3445): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3445): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3445): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3446): error C2535: 'CEGUI::String::size_type CEGUI::String::find(const int) const' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3388) : see declaration of 'CEGUI::String::find'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3496): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3496): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3496): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3497): error C2535: 'CEGUI::String::size_type CEGUI::String::rfind(const int) const' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3415) : see declaration of 'CEGUI::String::rfind'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3820): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3820): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3820): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3847): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3847): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3847): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3877): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3877): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3877): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3878): error C2535: 'CEGUI::String::size_type CEGUI::String::find_first_of(const int) const' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3820) : see declaration of 'CEGUI::String::find_first_of'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3925): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3925): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3925): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3926): error C2535: 'CEGUI::String::size_type CEGUI::String::find_first_not_of(const int) const' : member function already defined or declared
1> c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(3847) : see declaration of 'CEGUI::String::find_first_not_of'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(4302): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(4302): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(4302): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(4329): error C2327: 'CEGUI::String::utf8' : is not a type name, static, or enumerator
1>c:\program files (x86)\cegui\cegui-0.8.2\cegui\include\cegui\string.h(4329): fatal error C1003: error count exceeds 100; stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skippe
d ==========
Code:
#include <RendererModules\Ogre\Renderer.h>
int main(){
// Bootstrap CEGUI::System with an OgreRenderer object that uses the
// default Ogre rendering window as the default output surface, an Ogre based
// ResourceProvider, and an Ogre based ImageCodec.
CEGUI::OgreRenderer& myRenderer =
CEGUI::OgreRenderer::bootstrapSystem();
}
The code comes from http://www.cegui.org.uk/docs/current/rendering_tutorial.html ; Even that doesnt say anything about include xutility or iosfwd I already tryed to do but the error is the same, I also tryed to open the files from VS but since I'm not an expert I couldnt fully understand to check for any errors, which I can't believe thats wrong since its a default file..
I know this is an old post but I figured I would answer it.
If you include cegui-0.8.7\cegui\include\CEGUI in your MSVC include directories then it will suck up the String.h file in there and then will use THAT definition EVERYWHERE. Thus you start seeing things like xutility and iosfwd show up in the tainting.
Instead you must include ...\cegui-0.8.7\cegui\include so that it is scoped with CEGUI and does not confuse your entire build system.
Hope this helps someone!

Build Error in the "refclock.h" header file, a part of Windows platform SDK

I am building a VC++ solution & using Win& SDK & Win8 SDK (including these paths in LIB & INCLUDE settings of VS2008).
But I am getting the following build error in refclock.h header file.
I don't understand how can we get the error in a standard MSFT header file. Can anyone kindly help me in getting this fixed?
c:\program files\microsoft sdks\windows\v7.0\samples\multimedia\directshow\baseclasses\refclock.h(80) : error C2061: syntax error : identifier 'CAMSchedule'
2>c:\program files\microsoft sdks\windows\v7.0\samples\multimedia\directshow\baseclasses\refclock.h(139) : error C2143: syntax error : missing ';' before '*'
2>c:\program files\microsoft sdks\windows\v7.0\samples\multimedia\directshow\baseclasses\refclock.h(139) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\program files\microsoft sdks\windows\v7.0\samples\multimedia\directshow\baseclasses\refclock.h(139) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\program files\microsoft sdks\windows\v7.0\samples\multimedia\directshow\baseclasses\refclock.h(139) : warning C4183: 'GetSchedule': missing return type; assumed to be a member function returning 'int'
2>c:\program files\microsoft sdks\windows\v7.0\samples\multimedia\directshow\baseclasses\refclock.h(178) : error C2143: syntax error : missing ';' before '*'
2>c:\program files\microsoft sdks\windows\v7.0\samples\multimedia\directshow\baseclasses\refclock.h(178) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\program files\microsoft sdks\windows\v7.0\samples\multimedia\directshow\baseclasses\refclock.h(178) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\program files\microsoft sdks\windows\v7.0\samples\multimedia\directshow\baseclasses\refclock.h(139) : error C2065: 'm_pSchedule' : undeclared identifier
2>c:\program files\microsoft sdks\windows\v7.0\samples\multimedia\directshow\baseclasses\refclock.h(166) : error C2065: 'm_pSchedule' : undeclared identifier
2>c:\program files\microsoft sdks\windows\v7.0\samples\multimedia\directshow\baseclasses\refclock.h(166) : error C2227: left of '->GetEvent' must point to class/struct/union/generic type
It's caused by an error in the refclock.h header and the order your include directories are specified in Visual Studio.
You need to have the BaseClasses directory (Samples/Multimedia/DirectShow) before the SDK include directory, since they both have a schedule.h file and refclock.h uses <> not "" for the include.

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.