Jump to content
  • Advertisement
Sign in to follow this  
lukeymoo

Allegro Linker Error

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

Hey everyone, I've tried searching around multiple forums and sites in search of an answer but none seem to work.
I have a header file that holds global BITMAP variables and I've included them in 2 CPP files, that is the gameEngine.cpp and Main.cpp

Here is my Bitmaps.h file
[source lang='cpp']
#ifndef BITMAPS_H
#define BITMAPS_H
#include

extern BITMAP *buffer;
extern BITMAP *p_right;
extern BITMAP *p_left;
extern BITMAP *p_jump_left;
extern BITMAP *p_jump_right;[source='gameEngine.cpp']if(set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0) < 0) { MessageBox(NULL, "Allegro failed to initialize the graphics!", "Error!", MB_OK | MB_ICONEXCLAMATION); exit(1); } set_window_title("TITLE REMOVED"); BITMAP *buffer = create_bitmap(640, 480); BITMAP *p_right = load_bitmap("gfx\\p_right.bmp", NULL); BITMAP *p_left = load_bitmap("gfx\\p_left.bmp", NULL); BITMAP *p_jump_left = load_bitmap("gfx\\p_jump_left.bmp", NULL); BITMAP *p_jump_right = load_bitmap("gfx\\p_jump_right.bmp", NULL); BITMAP *menu_background = load_bitmap("data\\menu_background.bmp", NULL); BITMAP *menu_play = load_bitmap("data\\play.bmp", NULL); BITMAP *menu_info = load_bitmap("data\\info.bmp", NULL); BITMAP *menu_exit = load_bitmap("data\\exit.bmp", NULL);[/source]

extern BITMAP *menu_background;
extern BITMAP *menu_play;
extern BITMAP *menu_info;
extern BITMAP *menu_exit;
#endif[/source]
[font=arial, verdana, tahoma, sans-serif][size=2]Sorry for long post,

And here is a snippet of my gameEngine.cpp in the 'init()' function
[source lang="cpp"]
set_window_title("Halo: The Untold");
BITMAP *buffer = create_bitmap(640, 480);
BITMAP *p_right = load_bitmap("gfx\\p_right.bmp", NULL);
BITMAP *p_left = load_bitmap("gfx\\p_left.bmp", NULL);
BITMAP *p_jump_left = load_bitmap("gfx\\p_jump_left.bmp", NULL);
BITMAP *p_jump_right = load_bitmap("gfx\\p_jump_right.bmp", NULL);
BITMAP *menu_background = load_bitmap("data\\menu_background.bmp", NULL);
BITMAP *menu_play = load_bitmap("data\\play.bmp", NULL);
BITMAP *menu_info = load_bitmap("data\\info.bmp", NULL);
BITMAP *menu_exit = load_bitmap("data\\exit.bmp", NULL);
show_mouse(screen);
[/source]
And my main.cpp's use of these BITMAPs
[source lang="cpp"]
switch(g.state)
{
case MENUSCREEN:
//making menuscreen background
draw_sprite(buffer, menu_background, 0, 0);
masked_blit(menu_play, buffer, 0, 0, 300, 300, 189, 50);
masked_blit(menu_info, buffer, 0, 0, 300, 350, 189, 50);
masked_blit(menu_exit, buffer, 0, 0, 300, 400, 189, 50);
/*play = 300, 300 info = 300, 350 exit = 300, 400*/
break;
case GAME:
break;
case CREDITS:
break;
}
[/source]
Here are the list of confusing linker errors
<div>Linking...
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_exit" (?menu_exit@@3PAUBITMAP@@A)
Main.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_exit" (?menu_exit@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_info" (?menu_info@@3PAUBITMAP@@A)
Main.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_info" (?menu_info@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_play" (?menu_play@@3PAUBITMAP@@A)
Main.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_play" (?menu_play@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_background" (?menu_background@@3PAUBITMAP@@A)
Main.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_background" (?menu_background@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * p_jump_right" (?p_jump_right@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * p_jump_left" (?p_jump_left@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * p_right" (?p_right@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * p_left" (?p_left@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * buffer" (?buffer@@3PAUBITMAP@@A)
Main.obj : error LNK2001: unresolved external symbol "struct BITMAP * buffer" (?buffer@@3PAUBITMAP@@A)

Thanks ahead for reply :][/font]

Share this post


Link to post
Share on other sites
Advertisement
Hidden
Sorry for long post,

And here is a snippet of my gameEngine.cpp in the 'init()' function
[source lang="cpp"]
set_window_title("Halo: The Untold");
BITMAP *buffer = create_bitmap(640, 480);
BITMAP *p_right = load_bitmap("gfx\\p_right.bmp", NULL);
BITMAP *p_left = load_bitmap("gfx\\p_left.bmp", NULL);
BITMAP *p_jump_left = load_bitmap("gfx\\p_jump_left.bmp", NULL);
BITMAP *p_jump_right = load_bitmap("gfx\\p_jump_right.bmp", NULL);
BITMAP *menu_background = load_bitmap("data\\menu_background.bmp", NULL);
BITMAP *menu_play = load_bitmap("data\\play.bmp", NULL);
BITMAP *menu_info = load_bitmap("data\\info.bmp", NULL);
BITMAP *menu_exit = load_bitmap("data\\exit.bmp", NULL);
show_mouse(screen);
[/source]
And my main.cpp's use of these BITMAPs
[source lang="cpp"]
switch(g.state)
{
case MENUSCREEN:
//making menuscreen background
draw_sprite(buffer, menu_background, 0, 0);
masked_blit(menu_play, buffer, 0, 0, 300, 300, 189, 50);
masked_blit(menu_info, buffer, 0, 0, 300, 350, 189, 50);
masked_blit(menu_exit, buffer, 0, 0, 300, 400, 189, 50);
/*play = 300, 300 info = 300, 350 exit = 300, 400*/
break;
case GAME:
break;
case CREDITS:
break;
}
[/source]
Here are the list of confusing linker errors
[source lang="cpp"]

Linking...
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_exit" (?menu_exit@@3PAUBITMAP@@A)
Main.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_exit" (?menu_exit@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_info" (?menu_info@@3PAUBITMAP@@A)
Main.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_info" (?menu_info@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_play" (?menu_play@@3PAUBITMAP@@A)
Main.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_play" (?menu_play@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_background" (?menu_background@@3PAUBITMAP@@A)
Main.obj : error LNK2001: unresolved external symbol "struct BITMAP * menu_background" (?menu_background@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * p_jump_right" (?p_jump_right@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * p_jump_left" (?p_jump_left@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * p_right" (?p_right@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * p_left" (?p_left@@3PAUBITMAP@@A)
gameEngine.obj : error LNK2001: unresolved external symbol "struct BITMAP * buffer" (?buffer@@3PAUBITMAP@@A)
Main.obj : error LNK2001: unresolved external symbol "struct BITMAP * buffer" (?buffer@@3PAUBITMAP@@A)
[/source]
Thanks ahead for reply :]

Share this post


Link to post
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!