PDA

View Full Version : compiler error



ncc1701
04-30-2005, 03:36 AM
well, i'm a beginner at the very first stage. i'm using lcc-win32 as my compiler. when i try to compile my codes, written in C, the compiler shows me many errors for the gl.h (!) file,

Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1151 no type specified. Defaulting to int
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1151 Syntax error; missing semicolon before `void'
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1151 Syntax error; missing semicolon before `glAccum'
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1151 no type specified. Defaulting to int
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1152 no type specified. Defaulting to int
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1152 Syntax error; missing semicolon before `void'
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1152 Syntax error; missing semicolon before `glAlphaFunc'
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1152 no type specified. Defaulting to int
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1153 no type specified. Defaulting to int
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1153 Syntax error; missing semicolon before `GLboolean'
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1153 redefinition of 'APIENTRY'
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1152 Previous definition of 'APIENTRY' here
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1153 Syntax error; missing semicolon before `glAreTexturesResident'
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1153 no type specified. Defaulting to int
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1154 no type specified. Defaulting to int
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1154 Syntax error; missing semicolon before `void'
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1154 redefinition of 'APIENTRY'
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1153 Previous definition of 'APIENTRY' here
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1154 Syntax error; missing semicolon before `glArrayElement'
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1154 no type specified. Defaulting to int
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1155 no type specified. Defaulting to int
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1155 Syntax error; missing semicolon before `void'
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1155 Syntax error; missing semicolon before `glBegin'
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1155 no type specified. Defaulting to int
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1156 no type specified. Defaulting to int
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1156 Syntax error; missing semicolon before `void'
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1156 Syntax error; missing semicolon before `glBindTexture'
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1156 no type specified. Defaulting to int
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1157 no type specified. Defaulting to int
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1157 Syntax error; missing semicolon before `void'
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1157 Syntax error; missing semicolon before `glBitmap'
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1157 no type specified. Defaulting to int
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1158 no type specified. Defaulting to int
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1158 Syntax error; missing semicolon before `void'
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1158 Syntax error; missing semicolon before `glBlendFunc'
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1158 no type specified. Defaulting to int
Warning c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1159 no type specified. Defaulting to int
Error c:\lcc\hellogl.c: c:\lcc\include\gl\gl.h: 1159 too many errors

what are these errors? how can i solve em? Plz help!!!! :confused:

mikael_aronsson
04-30-2005, 09:35 PM
Hi !

Did you put a #include "windows.h" before you included gl.h ?

To minimize all chances of portability our friend Bill has made sure you must include windows.h before gl.h

Mikael

bansheeogl
04-30-2005, 09:38 PM
First of all Bill Gates had nothing to do with that, and secondly, its common, its normal, its no ones fault.

if gl.h requires any windows.h, then its known that windows.h will need to be included before gl header.

Silkut
05-01-2005, 06:28 AM
you can put your code here, it can help

mikael_aronsson
05-01-2005, 11:11 PM
First of all Bill Gates had nothing to do with that, and secondly, its common, its normal, its no ones fault.

if gl.h requires any windows.h, then its known that windows.h will need to be included before gl header. It is not common, gl.h is a platform independant header file to be used with OpenGL, it should never require that YOU must include a platform specific header file before you can include gl.h, either they should include it in their gl.h or make it work witout any windows.h file, and I do not know the person that made that joke up so I put the blame on the one at the top of the tree.

Lots of people make code thay think is platform independant just to find out that it does not compile on windows.

Mikael

RigidBody
05-01-2005, 11:41 PM
i think i have to agree with mikael. just compiled


#include<GL/gl.h>

int main(int argc, char *argv[]){

glBegin(GL_QUADS);
glVertex3f(-1., -1., 0.);
glVertex3f( 1., -1., 0.);
glVertex3f( 1., 1., 0.);
glVertex3f(-1., 1., 0.);
glEnd(); } in linux. compiled without any error.

where does gl.h actually come from in windows? do nvidia not provide their own gl.h headers with the windows driver?

ncc1701
05-02-2005, 12:53 AM
well, after i included the windows.h header, there was no problem anymore for the gl.h header. Hmmm, now i have problems with glut.h!!!
Here's my code with the error message (it's omy first opengl progs :D )

#include <windows.h>
#include <gl\glut.h>
#include <glext.h>
#include <wglext.h>
#include <stdio.h>
#include <stdlib.h>
void init(void){
glClearColor(1.0, 1.0, 1.0, 1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho( 0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}

void display(void){
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.75, 0.25,0.0);
glVertex3f(0.75, 0.75, 0.0);
glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();
}
int main(int argc, char **argv){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250,250);
glutInitWindowPosition(100,100);
glutCreateWindow("myhellogl");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}

error:
cpp: c:\lcc\include\win.h:504 c:\lcc\include\windows.h:9 c:\lcc\include\glext.h:39 c:\lcc\hellogl.c:2 Macro redefinition of WINGDIAPI, previously defined in c:\lcc\include\gl\glut.h 40
Warning c:\lcc\include\gl\glut.h: 549 static 'int function(pointer to void function(int)) glutCreateMenu_ATEXIT_HACK' is not referenced

Where can i get the headers from nvidia (my card is tnt2)? If i compile this in linux, how can i make this work in windows???Thanx!!! :)