Sign in to follow this  
Axesor

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

Recommended Posts

Axesor    100
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 this post


Link to post
Share on other sites
Drew_Benton    1861
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 this post


Link to post
Share on other sites
Axesor    100
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 this post


Link to post
Share on other sites
Drew_Benton    1861
Quote:
Original post by Axesor
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....


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;

instead.

Share this post


Link to post
Share on other sites
Axesor    100
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 this post


Link to post
Share on other sites
Axesor    100
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 this post


Link to post
Share on other sites
Drew_Benton    1861
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 this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this