Jump to content
  • Advertisement
Sign in to follow this  
Origanlmaxin

Untitled

This topic is 4815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok.... BIG problem.. im trying very hard to start the opengl graphics tutorials but for one big problem... the code doesnt work for me!!! it wont compile :( i am using the Dev-C++ development environment but the code wont compile... EVEN when i tryed downloading the source for the tutorial that was made for Dev-c++ ... curiously it compiled as it was.. yet when i copy and paste the EXACT code into a new page in Dev-c++ .. it doesnt compile... its back to errors. please PLEASE somone explain this because otherwise i cannot continue to learn... FRUSTRATING!!!!! ~ORI~

Share this post


Link to post
Share on other sites
Advertisement
Post your errors, otherwise people trying to help you can only speculate.

Sounds like linker errors, which means you just have to set the appropriate options in your IDE.



Boder Games

Share this post


Link to post
Share on other sites
sorry.. didnt think of that lol...

ok .. heres the linker errors:

c:\dev-c++\examples\opengl\untitled1.o(.text+0x16c):untitled1.cpp: undefined reference to `glClearColor@16'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x179):untitled1.cpp: undefined reference to `glClear@4'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x181):untitled1.cpp: undefined reference to `glPushMatrix@0'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x198):untitled1.cpp: undefined reference to `glRotatef@16'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x1a2):untitled1.cpp: undefined reference to `glBegin@4'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x1b6):untitled1.cpp: undefined reference to `glColor3f@12'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x1c8):untitled1.cpp: undefined reference to `glVertex2f@8'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x1dc):untitled1.cpp: undefined reference to `glColor3f@12'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x1ff):untitled1.cpp: undefined reference to `glVertex2f@8'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x213):untitled1.cpp: undefined reference to `glColor3f@12'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x236):untitled1.cpp: undefined reference to `glVertex2f@8'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x23e):untitled1.cpp: undefined reference to `glEnd@0'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x243):untitled1.cpp: undefined reference to `glPopMatrix@0'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x3b7):untitled1.cpp: undefined reference to `wglCreateContext@4'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x3d5):untitled1.cpp: undefined reference to `wglMakeCurrent@8'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x3f2):untitled1.cpp: undefined reference to `wglMakeCurrent@8'
c:\dev-c++\examples\opengl\untitled1.o(.text+0x401):untitled1.cpp: undefined reference to `wglDeleteContext@4'

all undefined references... and when i tryed:

#define "....."

it didnt fix them

Share this post


Link to post
Share on other sites
I don't use that compiler, but what it looks like is that when you downloaded the project, the project options already included the option of including the OpenGL header files. And then even if you paste the same code, if you don't include them, the functions aren't there. I'd say go to the part of the compiler that sets up what headers/libraries are included and add the required OpenGL libraries. Anyone else who uses the same compiler should be able to tell you how.

Share this post


Link to post
Share on other sites
Quote:
Original post by kburkhart84
Anyone else who uses the same compiler should be able to tell you how.


Origanlmaxin, you will need to link in:
-lmingw32
-lopengl32
-lglu32

This can be done by going to "Project->Project Options". Then in the "Parameters" tab, you will need to add those lines in the "Linker" box. You should not get any more linker errors now. I'm not sure if the mingw32 is needed for sure, but the other 2 are.

If you ever get an "undefined reference to" error there are two things that are happening. 1 - it's your code and you forgot to implement something that you have defined and used, or 2 - it's another library and you are using it without including the correct library that implements it. Just something to keep in mind for the future [wink]

Share this post


Link to post
Share on other sites
This is the most frequantly made mistake.... CANT WE DO SOMETHING ABOUT IT...
Have a Lesson 00 Where it explains that you need 2 link the libraries and shows how to do it.....

I personnaly prefer to use
pragma comment () and include it in the code rather that the project...

Must be because i hate moving the mouse

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!