Public Group

# undefined reference error. It has something to do with the libraries I'm including.

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

## Recommended Posts

Hello, thanks for reading this. I'm using codeblocks. I copied glaux.h and glut.h to the include directory of the Ming compiler that comes with codeblocks. I also copied 2 corresponding files to the lib directory; and copied a file tot my windows system folder. The error I get is as follows: 8]+0x32c):d:\nt\private\wind||undefined reference to _imp__CreateCompatibleDC@4'| 8]+0x3e3):d:\nt\private\wind||undefined reference to _imp__CreateDIBSection@24'| 8]+0x41d):d:\nt\private\wind||undefined reference to _imp__SelectObject@8'| 8]+0x465):d:\nt\private\wind||undefined reference to _imp__SetDIBits@28'| 8]+0x57c):d:\nt\private\wind||undefined reference to _imp__DeleteDC@4'| 8]+0xa1):d:\nt\private\wind||undefined reference to _imp__GetStockObject@4'| 8]+0x28):d:\nt\private\wind||undefined reference to _imp__GetPaletteEntries@16'| 0]+0x28):d:\nt\private\wind||undefined reference to _imp__GetPaletteEntries@16'| 0]+0x8):d:\nt\private\wind||undefined reference to _imp__SwapBuffers@4'| 0]+0x20):d:\nt\private\wind||undefined reference to _imp__GetPaletteEntries@16'| 4]+0x13):d:\nt\private\wind||undefined reference to _imp__SetSystemPaletteUse@8'| 4]+0x37):d:\nt\private\wind||undefined reference to _imp__SetSystemPaletteUse@8'| 4]+0x10):d:\nt\private\wind||undefined reference to _imp__GetStockObject@4'| 4]+0x1c):d:\nt\private\wind||undefined reference to _imp__GetPaletteEntries@16'| 4]+0x9a):d:\nt\private\wind||undefined reference to _imp__GetStockObject@4'| 4]+0xa7):d:\nt\private\wind||undefined reference to _imp__GetPaletteEntries@16'| 4]+0xbe):d:\nt\private\wind||undefined reference to _imp__GetPaletteEntries@16'| 0]+0x18):d:\nt\private\wind||undefined reference to _imp__GetStockObject@4'| 0]+0x2e):d:\nt\private\wind||undefined reference to `_imp__GetStockObject@4'| ||=== Build finished: 23 errors, 4 warnings ===| I've got linker options: "-lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 -lglaux" and included a bunch of libs: #include <GL\gl.h> #include <GL\glu.h> #include <GL\glut.h> #include <GL\glaux.h> #include <GL\glext.h> #include <stdio.h> #include <stdlib.h>

##### Share on other sites
The linking errors you are having a windows based linking error you must not have a windows lib not included.

The linking errors are not OpenGL based :)

just check up what lib's you need included for windows as there are quite a few.

I would also recommend you update your compiler to the free Microsoft visual C++ express edition as it is free and after a small amount of effort will do windows based apps.

To do the windows based applications with the VC++ express it will require you to download the platform SDK but there is a MSDN.com walk through on how to set it all up.

Regards Jouei.

##### Share on other sites
I think you need to re-order those flags like this: "-lwinmm -lgdi32 -lopengl32 -lglu32 -lglut32 -lglaux", I recall reading somewhere that the order was important.

EDIT: And you might need to #include <windows.h>. If you don't have the Platform SDK you'll need that first.

##### Share on other sites
Okay so they're windows errors.
Including <windows.h> in all my errors doesn't solve the problem.
But even more, I want my program to work cross platform, so I guess I can't include anything windowsy. It's a console application with a glut window. One of the windows errors also comes from the glut.h file. Could it be possible that I have some kind of "windows only" glut installed?

EDIT:

I changed the glut.h and glut library files and now it does work!
No more windows required =)

##### Share on other sites
I'm not sure if this will help, but try including glut.h before the other OpenGL related headers. I remember that this sometimes solves certain problems, but I don't remember which ones.

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633735
• Total Posts
3013592
×