Untitled

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

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 on other sites

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

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 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 on other sites
Quote:
 Original post by kburkhart84Anyone 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 on other sites
Drew_Benton

i assuredly am in your debt.

you have solved so much frustration on my part.

MUCH apreciated.

~ORI~

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

1. 1
Rutin
44
2. 2
3. 3
4. 4
5. 5

• 13
• 10
• 12
• 10
• 13
• Forum Statistics

• Total Topics
632996
• Total Posts
3009778
• Who's Online (See full list)

There are no registered users currently online

×