# OpenGL MinGW with OpenGL

## Recommended Posts

I'm trying to compile an OpenGL program using MinGW, but I'm not having much luck. The following is my output: C:\progs>g++ torus.cpp -lopengl32 -lglu32 -lglut32 -o torus.exe torus.cpp:13:1: warning: "M_PI" redefined In file included from torus.cpp:11: C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/math.h:58:1: warning: this is the location of the previous definition C:\DOCUME~1\AARONC~1.PA0\LOCALS~1\Temp/ccCedaaa.o:torus.cpp:(.text+0x1c): undefined reference to __glutInitWithExit@12' C:\DOCUME~1\AARONC~1.PA0\LOCALS~1\Temp/ccCedaaa.o:torus.cpp:(.text+0x3d): undefined reference to __glutCreateWindowWithExit@8' C:\DOCUME~1\AARONC~1.PA0\LOCALS~1\Temp/ccCedaaa.o:torus.cpp:(.text+0x5d): undefined reference to __glutCreateMenuWithExit@8' collect2: ld returned 1 exit status C:\progs> I have the the following header files in c:\MinGW\include\GL gl.h gluax.h glext.h glu.h glui.h glut.h Any ideas on what to do? Thanks.

##### Share on other sites
I don't think MinGW ships with GLUT (the linker errors are for missing GLUT functions). You're probably going to have to download and build the library yourself (with MinGW), then specify the path to the GLUT library on the command line when you compile.

##### Share on other sites
Quote:
 Original post by taesen00C:\progs>g++ torus.cpp -lopengl32 -lglu32 -lglut32 -o torus.exe

I don't think this is related to your problem, but your link order is backward. It should be -lglut32 -lglu32 -lopengl32 (and every time I have used a native glut it has been named just -lglut).

##### Share on other sites
I would say since your running from a temp folder, me thinks your trying to run from a zip at which point it won't work. Try from a directory such as "C:\Stuff"

##### Share on other sites
Thanks for the tips. I tried building the library myself, but that didn't happen. Not sure why it's going to temp files though, but as far as I know, I'm not doing anything from an compressed folders.

Anywhere I can find some directions on how to build the library using MinGW?

##### Share on other sites
Woohoo! Got it. Looks like I didn't have the glut32.lib in the right place. Thanks for the suggestions though. I put it in the mingw/lib and all was well.

##### Share on other sites
Quote:
 Original post by NeutrinohunterI would say since your running from a temp folder, me thinks your trying to run from a zip at which point it won't work. Try from a directory such as "C:\Stuff"

No, no, no. The temp folder is where the object files are output before linking. Once the exe is built, these is no need for them so they are deleted.
Look at his working dir - "C:\progs>" it's not a temp folder.

I suggest using Dev-Cpp, it's takes care of all the command line stuff. It's like Visual Studio for MinGW

##### Share on other sites
Quote:
 Original post by XTAL256I suggest using Dev-Cpp, it's takes care of all the command line stuff. It's like Visual Studio for MinGW

Or Visual Studio. It's like Dev-CPP for the twenty-first century.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
627697
• Total Posts
2978680
• ### Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange()`, which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 20
• 14
• 12
• 10
• 12