Well, the basic structure is a form which uses multiple classes defined in seperate files.
Below is my controller class which is supposed to keep track of which files are opened. It's included in both the form and the Map.cpp file, which contains all Map function implementations. I'm supposing these files aren't needed here because all they do is include the file seen below.



#include "Map.h"
#include "Array.h"

class Controller
		Controller() {}
		~Controller() {}

		//Retreive private data
		static Map GetCurrentMap() {return *currentMap;}

		//Set private data
		static void SetCurrentMap(Map map) {currentMap = ↦}

		//Opened maps
		static Arrayy<Map> Maps;

		//Current active map in editor window
		static Map* currentMap;

	Map* Controller::currentMap;  //Saving space for static variable
	Arrayy<Map> Controller::Maps;  //Saving space for static variable


Compiler errors:

1>Mapeditor.obj : error LNK2005: "private: static class Map * Controller::currentMap" (?currentMap@Controller@@$$Q0PAVMap@@A) already defined in Map.obj
1>Mapeditor.obj : error LNK2005: "public: static class Arrayy<class Map> Controller::Maps" (?Maps@Controller@@$$Q2V?$Arrayy@VMap@@@@A) already defined in Map.obj

It seems the "Controller.h" file is included twice, which it should be.. But normally it should skip to #endif and not overwrite the static variable declarations. Yet I have no idea why it doesn't.
If it matters for anything, I'm using visual c++ 2008. I've been messing around with the options, but that seemed to result in nothing but more errors..

Thanks for any input :)

8 Years
Discussion Span
Last Post by BeyondTheEye
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.