#include <player.h>
#include <inventory.h>
#include <quest.h>
#include <iostream>
usingnamespace player;
int main(){
//Logic Phase
init_inventory();
init_questlog();
for (int x = 0; x < 25; x++)
{
cout << x << ":" << quest_log[x].title;
}
//Initial Graphics Phase
//Open render window
//Load Graphics
//Game loop
//Render phase
return 0;
}
I'm still getting my bearings when it comes to object oriented programming, I'm really learning as I go, but I am getting a message that doesn't make sense to me when I try and compile this code.
quest.cpp:(.bss+0x0): multiple definition of `quest_log'
main.cpp:(.bss+0x0): first defined here
[Error] ld returned 1 exit status
This object is defined in a header file and is then included in multiple files, you can't do this. Also, it's a global variable, and you should not have global variables.
quest_log should be in main and should be its own class, init_questlog and add_questlog should be members of the class.
That makes a lot more sense, and yeah I've heard the global variable thing, but I was also reading that in games it's sometimes necessary. Thank you very much :).