Archived

This topic is now archived and is closed to further replies.

Linker error

This topic is 5152 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

Im going through the tutorials at gametutorials.com, and I keep getting something called a Linker error when Im compiling. Sorry if this is a stupid question but what the hell is a linker error and what can I do to fix it?

Share this post


Link to post
Share on other sites
A linker error is an error encountered by the linker. The linker is the program which takes compiled object files and libraries and stitches them together into a program.

The most common linker errors are caused by not including the proper libraries, by failing to define functions that are used, and by improperly organizing templated classes. But the only real way for us to help you is if you post the actual errors in question.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
I am trying the win32 tutorial 2 which is colored text centered in a window. I am coming up with undefined reference to SetTextColor@8 and TextOutA@20. I guess I really need to buy a book.

Share this post


Link to post
Share on other sites
Okeydoke, so that linker error means that there's a function called "SetTextColor" which is declared in a header file, and which your program uses, but which the linker is utterly unable to find the actual definition of, in either your source code or the libraries linked in.

Now, that's a Windows function. So we go to http://msdn.microsoft.com , which has an almost-complete documentation for WinAPI functions, and we find it here. Down at the bottom: "Library: Use Gdi32.lib". So you need to add that library into your linker options.


How appropriate. You fight like a cow.

[edited by - sneftel on November 5, 2003 5:57:12 PM]

Share this post


Link to post
Share on other sites