# This is driving me up the wall! (Linker Errors)[FIXED]

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

## Recommended Posts

I just forgot the winmain in my project. ALl other bugs have been removed. Thanks Drew_Benton. My program is buggless but did not show the desired results. [Edited by - Axesor on March 17, 2006 8:52:58 PM]

##### Share on other sites
What's happening is you have global variables defined in a header file, such as Vertex * image_struct; and that header file is being included in more than once cpp file, such as system.cpp and img.cpp. You need to make the global variables 'extern' in the header file, and define them in one of the cpp files. So, for example, extern Vertex * image_struct; goes in the header file, and in one CPP file, Vertex * image_struct;. That should take care of the first 3 linker errors. The next error looks like you need to change the runtime library for your project, or correctly declare your main function for the project. I'm not sure what you are using, so you will have to give more information on that.

##### Share on other sites
I have not found any other instance where those variables are re-defined. If you like I can post all of my code in a zip file. I am too ticked off, sitting here for 4 hours...

EDIT: I move my: Vertex image_struct over to my System.h and that leaves me with the others....

##### Share on other sites
Quote:
 Original post by AxesorI have not found any other instance where those variables are re-defined. If you like I can post all of my code in a zip file. I am too ticked off, sitting here for 4 hours...EDIT: I move my: Vertex image_struct over to my System.h and that leaves me with the others....

Let me try to explain again, if your variables are just declared once in a header file, and that header file is #included in more than once .cpp/.c file, then you will get those resulting linker errors, generally speaking. Did you try to make them extern in the header file and declare them once in a .cpp file as my first post explained? For that struct, if you have something like this in a header file:
struct myStruct{...} varStruct;

The same thing will happen, so you need to make that:
struct myStruct{...};extern myStruct varStruct;

##### Share on other sites
Thanks. Now all that's left is the pesky g_bitmap[n] and that Windows bug.
Do you know anyhting about those?

My libraries are set up:
opengl32.lib glu32.lib glaux.lib msimg32.lib winmm.lib
system: windows

And my processor definitions:
WIN32,_DEBUG,_WINDOWS,_MBCS

I also have all my libraries in place.

##### Share on other sites
Edit: The g_bitmap problem is fixed now too.
The only thing left is that Windows bug. Can someone help wit this final bug?

##### Share on other sites
If you are using a Win32 project, your main function needs to be:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

So check that over with. That should fix that problem, but if not, please show us how your main is right now.

##### Share on other sites
That was the part I forgot, but added later. I finally, as of this morning, got my class to load bitmaps and make them transparent. My next step: Animating them.
Thanks for all your help!
~Axesor

• 38
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631362
• Total Posts
2999577
×