Skip to main content
GameDev.net gamedev.net
🔒 Locked

Devcpp linker -_-

Started by _M0rgoth_ Oct 20, 2005 at 4:21 AM 4 replies 7.4k views
Original Post
_M0rgoth_
_M0rgoth_
Hi i'm noob of game programming so i decided to write some examples showed in Redbook. I tried example 1.2 "hello" but i have lots of [linker error] undefined reference to... the most functions that he probably does not recognise have prefix gl what i have to do ? i installed the dev pack for glut so i thing this is not the problem and i think i have not to add some lib to linklist in project->options etc etc. EXAMPLE: void display(void) { glClear (GL_COLOR_BUFFER_BIT); ... [Linker error] undefined reference to `glClear@4'
paic
paic
Hi,

In the "project options" panel, go in the "parameters" tab, then in the "linker" section, add :

-lglut32
-lglu32
-lopengl32


and recompile.
-lglut32 allow you to use the glut function (window, keyboard, mouse management)
-lglu32 allow you to use the glu functions (like gluPerspective if I remember well)
-lopengl32 allow you to use all the gl functions like glClear(), etc.
_M0rgoth_
_M0rgoth_
many thx paic,
your help is good (sorry for my bad english) so all the gl- and glut- function have been linked ... but...
now i have 4 linker error about some function not situated the file:

[Linker error] undefined reference to joyReleaseCapture@4'
[Linker error] undefined reference to
joySetCapture@16'
[Linker error] undefined reference to joyGetPosEx@8'
[Linker error] undefined reference to
joyGetPosEx@8'

can say me something about this ?
Kylotan
Kylotan
Try -lwinmm perhaps?
_M0rgoth_
_M0rgoth_
good, it compile... but why ?
what is winmm ?
every time i have to use glut, i have to link this winmm ?
paic
paic
It may come from the glut version you're using. Sometimes, to use a library, you have to include another one.

Anyway, when you have those linker error, copy the name of the function (joyReleaseCapture, for example : without the @XXX) and past into the msdn search tool (msdn.microsoft.com) then click on the link to the function (for joyReleaseCapture : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_joyreleasecapture.asp) and at the end of the page, you have the header to include (this, you don't need, since it's a linker error) and the lib to include. In this case : "Library: Use Winmm.lib" So try -lWinmm.

With this process, you can solve almost every basic linker error by yourseulf ^^

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.