🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

OpenGl Problems!

Started by
8 comments, last by GameDev.net 17 years, 9 months ago
Ok let me start off sayying that I know C++ half way decent. However I have never had to add any .lib files cause Compileing C++ has always been easy. I just bought a OpenGL book and the code that it wants me to try to learn off of and compile no matter what never works. I've been trying non stop for a couple of days now. I've been unable to compile any problem in OpenGl. I'm reading the book "Beginning OpenGL Game Programming " .... Been told that book uses Glut. Which is people say what my problem is. Compilers I've used: Visual C++ Express CodeBlocks Error's I get everyime: (CodeBlocks)
Compiling: Simple.cpp
In file included from Simple.cpp:1:
C:/Program Files/CodeBlocks/include/gl\glut.h:1: error: `ifndef' does not name a type
In file included from Simple.cpp:1:
C:/Program Files/CodeBlocks/include/gl\glut.h:716:2: #endif without #if
Process terminated with status 1 (0 minutes, 0 seconds)
So my question would be. Someone please help me figure out why nothing is compileing right. I'm having a hard time learning anything cause I am stuck. I need help figure out how to set up the lib's. Even though I thought I did them correct but I guess not or someone please help me figure out what is wrong. I will be greatful for help.
Advertisement
seems like you are lacking a # infront of the ifndef?
So... if you double-click that error, what does it say on that line?

My guess is that your glut.h file has somehow gotten corrupted -- probably missing a hash mark, or having some random character in front of the hash mark.

enum Bool { True, False, FileNotFound };
Well the line doesn't even exist so it doesn't take me to the errors? Well Can someone point me to a better header file then?
i think u can get a copy at www.opengl.org
I'm getting a new error now and I didnt do anything different.. Error is.
C:/Program Files/CodeBlocks/include/gl\glut.h:50: error: redeclaration of C++ built-in type `short'Process terminated with status 1 (0 minutes, 1 seconds)


Code
   /* XXX This is from Win32's <ctype.h> */#  ifndef _WCHAR_T_DEFINEDtypedef unsigned short wchar_t;#   define _WCHAR_T_DEFINED#  endif# endif
The last error is really bizarre, do you have obscure headers messing with "unsigned"? Test #ifdef unsigned and #ifdef short to ensure they aren't macros.

Omae Wa Mou Shindeiru

I only have 1 header file in the project and just the Simple.cpp code. Other then that i dont have anything else in there. CAn someone PLEASE tell me how to set up codeblocks to compile OpenGL and GLut cause I must be doing something wrong and I have been at this for a week. Feeling dumb cause I can get anyway in it cause I cant compile anything.. Please Help.
Madhatt3r,

I've never seen those errors before, but they appear to point to a corrupt glut.h.
Download a fresh copy from somewhere. Another thing I just noticed but
may not be of importance: it looks like your including gl\glut.h but in windows
it should be gl/glut.h

metrix
If that is the reason I keep getting random errors I am gonna cry myself tosleep tonight..

This topic is closed to new replies.

Advertisement