# What do you do?

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

## Recommended Posts

What do you do when you encounter a linking problem? The reason I ask is becuase I seem to encounter them all the time and I have yet to find a good metodology for dealing with them. Also is there any good references of what errors the g++ compiler can give and what to do about them? Oh and in case someone has had the same problem as me here is the stack trace:
  [Linker error] undefined reference to fseeko64'
[Linker error] undefined reference to ftello64'
[Linker error] undefined reference to fseeko64'
[Linker error] undefined reference to fseeko64'
[Linker error] undefined reference to inflateInit2_'
[Linker error] undefined reference to inflateEnd'
[Linker error] undefined reference to inflateReset'
[Linker error] undefined reference to inflate'
D:\My documents\coding\c++\HeroQuest w SDL&GL\Makefile.win [Build Error]  [HeroGate.exe] Error 1


I'm using Dev-C++ 4.9.9.0 as an IDE and the SDL/GL/FTGL/OpenIL libraries for the game.

##### Share on other sites
Hi,

I usually loop up the function in some documentation and check what libraries I need to include, because that's normally what I forgot if I get them.

##### Share on other sites
Well I'm too drunk to go into detail but there are 2two main linker errors that I encounter...

1. Undefined reference

You have used a variable which is declared (i.e. has a type and a name) but not defined (i.e. it has no specific value). Search for all references to the name and give it a value at some point (this is probably easier with an IDE like Visual Studio)

2. Multiple definition

You have used a variable with more than one value assigned to it. Search for all references to the name and remove all occurances of a value being assigned to the var except for the first one the compiler will encounter.

This is not software development law... this is just my experience, and I am drunk. If you want a proper answer, search the net or ask a more specific question about the two link errors described above.

##### Share on other sites
oh yeah... if you get lots of undefined refs you probably forgot to include a header somewhere...

##### Share on other sites
The thing is that many times (like the example above) I don't have a clue what library to include for it to go away. I think that it comes from using fseek but I should only have to include <stdlib.h> for that right? And not some stdlib...

##### Share on other sites
edit:and if it's COMPILER error,you might need to include something.

In devC++ ,click at project--->project parameters--->parameters tab , then click at "add library" and add that library.
I don't sure what lib do you need. It depends to what files do you include.Maybe sdlXXXX.o or sdlXXXX.a or something related to FTGL or maybe OpenIL (don't know what OpenIL is)

Also make sure you link with default library(libc or something like that). Use google for "library", "linker" , .

##### Share on other sites
The thing is that I KNOW that the exact same linker options that I have on my project work on my desktop but I can't get it to work on my laptop. That's whats really bugging me about these linker errors... they appear on one machine but not the other.... right now I have to program via VNC which is not to recommend at a ½MB line....

• 10
• 14
• 9
• 9
• 11