openGl - 143 errors from the includes - opengl

I'm working on windows XP with Visual C++ 2008 Express Eition.
Im trying to include:
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
and getting alot of errors like:
1>c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h(1152) : error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h(1152) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h(1152) : error C2146: syntax error : missing ';' before identifier 'glAccum'
1>c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h(1152) : error C2182: 'APIENTRY' : illegal use of type 'void'
etc.
My question is: can i use those includes or do i need to get those libraries from somewhere at first?
Thanks.

For reasons known to Microsoft only, the OpenGL headers provided with the various Windows SDKs require that you
#include <windows.h>
before.

You are probably trying to compile it as C++ instead of C, or something along those lines.

Why are you using SDKs named 'v6.0a' with VC++2K8? Are you sure that's the latest OpenGL headers you have? You should be using latest Platform SDK and OpenGL headers whenever possible.

Related

How to fix compile errors when including emscripten headers?

I'm trying to use emscripten Embind to bind C++ functions to JavaScript. Unfortunately I already get compile errors when including the specific header file with #include <emscripten/bind.h>.
I checked my emscripten environment and set an additonal Include Directory in VS2013 to the absolute path of the installation folder (also tried $(EMSCRIPTEN); and adapted the inlcude statement).
When compiling my project, I get 20+ compile errors:
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(24): error C2144: syntax error : 'bool' should be preceded by ';'
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(39): error C2146: syntax error : missing ';' before identifier 'TYPEID'
17> d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(42) : see reference to class template instantiation 'emscripten::internal::CanonicalizedID<T>' being compiled
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(54): error C2146: syntax error : missing ';' before identifier 'TYPEID'
...
I tried emscripten 1.22.0 and 1.25.0 and verified my emscripten environment following those instructions. What am I missing?
As far as I know, of the MS Visual Studio editions, only VS2010 is supported in Emscripten.
http://kripken.github.io/emscripten-site/docs/getting_started/getting_started_with_emscripten_and_vs2010.html#getting-started-emscripten-from-visual-studio

Errors building for Windows XP with Visual Studio 2013 Express

EDIT: Solved! See bottom.
I am trying to make my C++/OpenGL game compatible with windows XP.
Currently I am using Visual Studio 2013 express. I followed the instructions here and changed the Platform Toolset to v120_xp, but now I am getting errors in winbase.h and some other files.
My windows specific includes look like this:
#include <Windows.h>
#include <tchar.h>
#include <strsafe.h>
#include <direct.h>
#include <sys/types.h>
#include <dirent.h>
Here are some of the errors I am getting:
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\winbase.h(6133): error C2226: syntax error : unexpected type 'LPSTR'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\winbase.h(6141): error C2226: syntax error : unexpected type 'LPWSTR'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\stralign.h(113): error C2065: 'wcscpy_instead_use_StringCchCopyW_or_StringCbCopyW' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\cstdio(46): error C2039: '_gets_instead_use_StringCchGetsA_or_StringCbGetsA' : is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\cstring(20): error C2039: 'strcat_instead_use_StringCchCatA_or_StringCbCatA' : is not a member of '`global namespace''
There are many other similar errors.
I would provide more code but this is quite a large project. If there is anything specific you need let me know. Any help would be appreciated!
Solution:
I figured it out when following Jerry's advice.
In one of my files I was including tchar.h and strsafe.h before Windows.h
Including Windows.h above them solved the problem.

Winbase.h doesn't support in creating DLL file

I would like to create a project use to call c++ method using c#. So, I need to create a dll file for all of my c++ function. But when i get an error in y sqlite source code such as "AreFileApisASNSI undeclared identifier". So, i import winbase.h which is part of the mingw-w64 runtime package to my visual studio 2012 express DLL project. After import the file, I get many errors such as below:-
error c4430: missing type specifier - int assumed. Note: C++ does not support default - int
error C2143: syntax error : missing ';' before '_stdcall'
error c1003 error count exceeds 100; stopping compilation
error c2061: syntax error: identifier ' WINBOOL'
error c2086: 'int_CRT_INLINE' : redefinition
error c2143: syntax error: missing ';' before ''
error C2146: syntax error : missing ';' before identifier 'LONGLONG'
error C2146: syntax error : missing ';' before identifier 'PVOID'
any solution for those error? please help!!
The documentation for the function has this header requirement:
WinBase.h (include Windows.h)
This is telling you that the function is declared in WinBase.h, but that you should include Windows.h which in turn will include WinBase.h. So, you need to change your include to
#include <Windows.h>
I also wonder why you are talking about mingw considering that your compiler is MSVC. That compiler ships with a comprehensive Windows SDK. Why would you be using an SDK from mingw?

Base Class Not Defined and Other Errors in Pong clone (C++)

Trying to get back into the swing of things with C++ development, so I've been trying to build a simple 'Pong' clone in C++, using MS Visual Studios 2010. At this point I'm trying to just get the game screen with a single, stationary paddle/racket to display, but am running into a series of errors. I've checked other similar posts and tried their techniques for resolving these issues, but to no avail. I've been building this in accordance with a series of tutorials over at 'GamesFromScratch.Com', but no one else there seemed to have any of the issues I'm facing, so I've decided to post about them over here. Thanks in advance for any help rendered.
Here is my failed build output:
VisibleGameObject.cpp
1>c:\documents and settings\lguser\my documents\visual studio 2010\projects\puck\puck\playerracket.h(7): error C2504: 'VisibleGameObject' : base class undefined
1> PlayerRacket.cpp
1>c:\documents and settings\lguser\my documents\visual studio 2010\projects\puck\puck\game.h(24): error C2146: syntax error : missing ';' before identifier '_player1'
1>c:\documents and settings\lguser\my documents\visual studio 2010\projects\puck\puck\game.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\lguser\my documents\visual studio 2010\projects\puck\puck\game.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\lguser\my documents\visual studio 2010\projects\puck\puck\game.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
And here are the files referenced in the error readout:
PlayerRacket.h:
http://pastebin.com/y1v1nJ8s
Game.h:
http://pastebin.com/CXNPbtiq
See y'all on the flipside,
Kian
You probably have cyclic includes: VisibleGameObject.h includes Game.h which includes PlayerRacket.h which includes VisibleGameObject.h. You have to somehow avoid including Game.h from VisibleGameObject.h.
Well, you didn't show the content of VisibleGameObject.h so I can only guess that it does not contain the VisibleGameObject class (the first error). Following errors are implied by the first one.

syntax error : missing ';' before identifier 'PVOID64' when compiling winnt.h

I've recently got the source-code on a application. When im trying to build the solution, I get an error in all parts where winnt.h is included. The error codes differs a bit, but they always point to these lines in winnt.h:
typedef void *PVOID;
typedef void * POINTER_64 PVOID64;
and
struct {
DWORD crc;
BYTE rgbReserved[14];
} CRC;
So, what could be the cause of this? winnt.h is a standard header and has not been modified. Does it has something to do with me using VS 2010, or me using 64-bit windows? or is it some sort of configuration which is needed?
EDIT:
Here's the exact error-codes:
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winnt.h(290): error C2146: syntax error : missing ';' before identifier 'PVOID64'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winnt.h(290): 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\winnt.h(8992): error C2146: syntax error : missing ';' before identifier 'Buffer'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winnt.h(8992): 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\winnt.h(8992): 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\winnt.h(11525): error C2059: syntax error : 'constant'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winnt.h(11525): error C2238: unexpected token(s) preceding ';'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winnt.h(11556): error C2059: syntax error : 'constant'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winnt.h(11556): error C2238: unexpected token(s) preceding ';'
You need to include windows.h rather than winnt.h. When you include windows.h it will, in turn, include winnt.h. You need to do it this way for the necessary macros to be in place that are needed to compile winnt.h.
In this case, POINTER_64 is defined in BaseTsd.h like this:
#define POINTER_64 __ptr64
But if you include winnt.h before including windows.h then POINTER_64 is not defined.
If you are using DirectX SDK, try changing the VC++ Directories for include and lib to be searched last.
It looks like your configuration of the Windows SDK is invalid.
This error is caused by the fact that the compiler is unable to recognize the 'POINTER_64' statement.
You may workaround this problem by replacing 'POINTER_64' with '__ptr64'.
I had the same issue recently. Then I've reinstalled the latest version of the Windows SDK and this fixed the problem.
UPDATE
#David Heffernan, correctly points to the fact that one should include windows.h instead of winnt.h
Try to remove DirectX SDK if you have one.
Here bug is accepted:
http://connect.microsoft.com/VisualStudio/feedback/details/508204/vc10-0-errors-while-compiling-winnt-h
Corrected manually syntax in winnt.h :
typedef void * POINTER_64 PVOID64; => typedef void * POINTER_64, * PVOID64;
If you are using librdkafka, you will get this error whenever "Windows.h" included.
I fixed it by rename "librdkafka/include/basetsd.h" to a different name, or access
this library header via sub path!
I think the author of this library made this file to deal with OS platform compatibility. But with the same file name "basetsd.h" as Windows Core, it just confusing Visual Studio.