i had a global variable but not above int main(), but above a class,something like this
1 2 3 4 5 6
//global variable
int* map;
int MAX_WIDTH;
class map{
//definiton and method
};
but when i compile it,it says that in main function there is multiple definition of map and MAX_WIDTH. but i also can't move it because the method in map class needs the map and MAX_WIDTH. What should i do?
Thanks for your help
I also want to insert it to my class, but something i forgot to tell you that the int*map values is depends on another class, okay i'll explain my real problem. i'm trying to use the source od a* algorithm from google code. but the definition of the "world map" in the code is global variable. what i need is i get the "world map" from another class. So here is the story line:
first i'll make the user to create the "world map",
then i'll pass the map to a* star algorithm class to get the cost of the travel