hm ok
thx guys
'multiple definition of variable'-error
I think you should put the variables in main.cpp and use the extern keyword in display.cpp
like this:
main.cpp
--------
BITMAP *ground;
BITMAP *grass;
PALETTE ground_pal;
PALETTE grass_pal;
int world[5][5] = { 1, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0, 0, 1, 0, 0,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1 };
display.cpp
-----------
extern BITMAP *ground;
extern BITMAP *grass;
extern PALETTE ground_pal;
// etc.
hope that helps
Matt
like this:
main.cpp
--------
BITMAP *ground;
BITMAP *grass;
PALETTE ground_pal;
PALETTE grass_pal;
int world[5][5] = { 1, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0, 0, 1, 0, 0,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1 };
display.cpp
-----------
extern BITMAP *ground;
extern BITMAP *grass;
extern PALETTE ground_pal;
// etc.
hope that helps
Matt
Or just not use globals, they''re not necessary. But that''s a flame war in itself! :-)
Why you shouldn''t use iostream.h - ever! | A Good free online C++ book
Why you shouldn''t use iostream.h - ever! | A Good free online C++ book
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement