Compiling opengl code using gcc through the command line

Started by
52 comments, last by 4mad3u5 10 years ago

I installed TDM-GCC and I am getting the same error messages

Advertisement

I installed TDM-GCC and I am getting the same error messages

Looking at your code, it seems you are using:

* freeglut

* glew

* the files are 32bit

Did you install the 32-bit version of TDM-GCC? If so you should make sure you have an up-to-date version of glew32 and freeglut32:

Windows binaries for freeglut:

http://files.transmissionzero.co.uk/software/development/GLUT/freeglut-MinGW.zip

Windows binaries for glew:

https://sourceforge.net/projects/glew/files/glew/1.10.0/glew-1.10.0-win32.zip/download

Make a 'lib' folder and 'include' folder. Copy the headers into /include and the libs into /lib

Copy all the header files from this hard-coded path also into ./include

F:\school\csci\opengl\SB5\Src\GLTools\include

Compile with:

g++ -Iinclude -Llib -lglew32 -lfreeglut Triangle.cpp

It's just a guess for what the compile line would look like. You are basically telling the compiler that all the .h files are in ./include and all the .a files are in ./lib.

You are also "utilizing" the glew32 and freeglut libraries, which are the libglew32.a and libfreeglut.a files respectively.

As a sidenote: I'm not sure why your teachers have not just set up a proper makefile with a working directory structure.

It's possible to create a project setup that compiles on both windows and (at least) Ubuntu-derived Linux as well as OS X without having to do anything but "make."

All you need is to create win32 linux osx folders inside "lib" folder and create a slightly more complicated makefile manually.

It's not the best solution, but it will work for the students.

For example you might not want to add the linux libs, since you typically install these libs with package managers, or manually with "make install." It would cover 32 and 64bit.

Better than hard-coding in network paths at least.

Oh and, is GLTools a library? If it is, then you need to compile it into a library, as well as include its headers.

k, thanks. I was currently checking to see if I was using the 32 bit versions of libfreeglut.a and libglew.a

k, thanks. I was currently checking to see if I was using the 32 bit versions of libfreeglut.a and libglew.a

Btw. did you add C:\TDM-GCC\bin to the PATH enviroment variable?

Because you need to execute g++ from the directory that contains Triangle.cpp

Come to think of it:

It looks like you are still using Dev-C++, which uses an old gcc. Probably. Uninstall it, and make sure it's removed from PATH.

Because you would not get the same error messages on windows, if you installed TDM-GCC. I think the installer adds C:\TDM-GCC\bin to PATH during the installation.

Also, make sure TDM-GCC is the same system type as the libraries you are trying to use with it. If g++ --version is 64-bit, you'll want the 64-bit libraries and vice versa.

no I uninstalled Dev C++

It is going to take me some time to make sure that I am doing everything you told me to do

I installed the 32 bit version of TDM

I set my new path to the bin dir SET PATH=%PATH%;C:\TDM-GCC-32\bin if that is the set path that you are talking about

I need to see if I did everything you said but when I put into the command line:

this is the command line you told me to do

g++ -IF:\school\csci\opengl\SB5\Src\GLTools\include -IF:\school\csci\opengl\SB5\freegl

ut-2.6.0\include -Llib -lglew32 -lfreeglut Triangle.cpp
and just for the heck of it I did mine
g++ -IF:\school\csci\opengl\SB5\Src\GLTools\include -IF:\school\csci\opengl\SB5\freegl
ut-2.6.0\include Triangle.cpp libglew32.a libfreeglut.a
I got a new error message saying this both times:
In file included from F:\school\csci\opengl\SB5\freeglut-2.6.0\include/GL/freeglut_std.h:121:0,
from F:\school\csci\opengl\SB5\freeglut-2.6.0\include/GL/glut.h:17,
from Triangle.cpp:11:
c:\tdm-gcc-32\include\gl\glu.h:225:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluBeginCurve (GLUnurbs* nurb);
^
c:\tdm-gcc-32\include\gl\glu.h:226:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluBeginPolygon (GLUtesselator* tess);
^
c:\tdm-gcc-32\include\gl\glu.h:227:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluBeginSurface (GLUnurbs* nurb);
^
c:\tdm-gcc-32\include\gl\glu.h:228:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluBeginTrim (GLUnurbs* nurb);
^
c:\tdm-gcc-32\include\gl\glu.h:229:1: error: 'GLAPI' does not name a type
GLAPI GLint APIENTRY gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const vo
ta);
^
In file included from F:\school\csci\opengl\SB5\freeglut-2.6.0\include/GL/freeglut_std.h:121:0,
from F:\school\csci\opengl\SB5\freeglut-2.6.0\include/GL/glut.h:17,
from Triangle.cpp:11:
c:\tdm-gcc-32\include\gl\glu.h:230:1: error: 'GLAPI' does not name a type
GLAPI GLint APIENTRY gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenu
, const void *data);
^
c:\tdm-gcc-32\include\gl\glu.h:231:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks);
^
c:\tdm-gcc-32\include\gl\glu.h:232:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluDeleteNurbsRenderer (GLUnurbs* nurb);
^
c:\tdm-gcc-32\include\gl\glu.h:233:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluDeleteQuadric (GLUquadric* quad);
^
c:\tdm-gcc-32\include\gl\glu.h:234:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluDeleteTess (GLUtesselator* tess);
^
c:\tdm-gcc-32\include\gl\glu.h:235:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops);
^
c:\tdm-gcc-32\include\gl\glu.h:236:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluEndCurve (GLUnurbs* nurb);
^
c:\tdm-gcc-32\include\gl\glu.h:237:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluEndPolygon (GLUtesselator* tess);
^
c:\tdm-gcc-32\include\gl\glu.h:238:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluEndSurface (GLUnurbs* nurb);
^
c:\tdm-gcc-32\include\gl\glu.h:239:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluEndTrim (GLUnurbs* nurb);
^
c:\tdm-gcc-32\include\gl\glu.h:240:1: error: 'GLAPI' does not name a type
GLAPI const GLubyte * APIENTRY gluErrorString (GLenum error);
^
c:\tdm-gcc-32\include\gl\glu.h:241:1: error: 'GLAPI' does not name a type
GLAPI const wchar_t * APIENTRY gluErrorUnicodeStringEXT (GLenum error);
^
c:\tdm-gcc-32\include\gl\glu.h:242:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data);
^
c:\tdm-gcc-32\include\gl\glu.h:243:1: error: 'GLAPI' does not name a type
GLAPI const GLubyte * APIENTRY gluGetString (GLenum name);
^
c:\tdm-gcc-32\include\gl\glu.h:244:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data);
^
c:\tdm-gcc-32\include\gl\glu.h:245:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view
^
c:\tdm-gcc-32\include\gl\glu.h:246:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ
uble upX, GLdouble upY, GLdouble upZ);
^
c:\tdm-gcc-32\include\gl\glu.h:247:1: error: 'GLAPI' does not name a type
GLAPI GLUnurbs* APIENTRY gluNewNurbsRenderer (void);
^
c:\tdm-gcc-32\include\gl\glu.h:248:1: error: 'GLAPI' does not name a type
GLAPI GLUquadric* APIENTRY gluNewQuadric (void);
^
c:\tdm-gcc-32\include\gl\glu.h:249:1: error: 'GLAPI' does not name a type
GLAPI GLUtesselator* APIENTRY gluNewTess (void);
^
c:\tdm-gcc-32\include\gl\glu.h:250:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluNextContour (GLUtesselator* tess, GLenum type);
^
c:\tdm-gcc-32\include\gl\glu.h:251:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc);
^
c:\tdm-gcc-32\include\gl\glu.h:252:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order,
m type);
^
c:\tdm-gcc-32\include\gl\glu.h:253:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value);
^
c:\tdm-gcc-32\include\gl\glu.h:254:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint
de, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type);
^
c:\tdm-gcc-32\include\gl\glu.h:255:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top);
^
c:\tdm-gcc-32\include\gl\glu.h:256:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start,
ble sweep);
^
c:\tdm-gcc-32\include\gl\glu.h:257:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
^
c:\tdm-gcc-32\include\gl\glu.h:258:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport);
^
c:\tdm-gcc-32\include\gl\glu.h:259:1: error: 'GLAPI' does not name a type
GLAPI GLint APIENTRY gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const
*view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);
^
c:\tdm-gcc-32\include\gl\glu.h:260:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type);
^
c:\tdm-gcc-32\include\gl\glu.h:261:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc);
^
c:\tdm-gcc-32\include\gl\glu.h:262:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluQuadricDrawStyle (GLUquadric* quad, GLenum draw);
^
c:\tdm-gcc-32\include\gl\glu.h:263:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluQuadricNormals (GLUquadric* quad, GLenum normal);
^
c:\tdm-gcc-32\include\gl\glu.h:264:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluQuadricOrientation (GLUquadric* quad, GLenum orientation);
^
c:\tdm-gcc-32\include\gl\glu.h:265:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluQuadricTexture (GLUquadric* quad, GLboolean texture);
^
c:\tdm-gcc-32\include\gl\glu.h:266:1: error: 'GLAPI' does not name a type
GLAPI GLint APIENTRY gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GL
hOut, GLenum typeOut, GLvoid* dataOut);
^
c:\tdm-gcc-32\include\gl\glu.h:267:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks);
^
c:\tdm-gcc-32\include\gl\glu.h:268:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluTessBeginContour (GLUtesselator* tess);
^
c:\tdm-gcc-32\include\gl\glu.h:269:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data);
^
c:\tdm-gcc-32\include\gl\glu.h:270:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
^
c:\tdm-gcc-32\include\gl\glu.h:271:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluTessEndContour (GLUtesselator* tess);
^
c:\tdm-gcc-32\include\gl\glu.h:272:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluTessEndPolygon (GLUtesselator* tess);
^
c:\tdm-gcc-32\include\gl\glu.h:273:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
^
c:\tdm-gcc-32\include\gl\glu.h:274:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data);
^
c:\tdm-gcc-32\include\gl\glu.h:275:1: error: 'GLAPI' does not name a type
GLAPI void APIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data);
^
c:\tdm-gcc-32\include\gl\glu.h:276:1: error: 'GLAPI' does not name a type
GLAPI GLint APIENTRY gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, con
nt *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ);
^
c:\tdm-gcc-32\include\gl\glu.h:277:1: error: 'GLAPI' does not name a type
GLAPI GLint APIENTRY gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GL
*proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW);

I set my path to the bin dir and then go to my working dir

This topic is closed to new replies.

Advertisement