I am scratching my head at the moment with this one.
I have a class which I have stripped right back to bare bones trying to work out why it wont compile in my app.
#pragma once
class Asset
{
public:
Asset()
{
++(this->nID); // Asset ID (auto-increments)
}
~Asset()
{
}
private:
static int nID;
};
int Asset::nID=0;
When I compile in my main application I get the following error;
"private: static int Asset::nID" ([email="?nID@Asset@@0HA"]?nID@Asset@@0HA[/email]) already defined in framework.obj
I have taken the above and put it into a brand new C++ project and it compiles fine.
I cant understand why it wont compile in the 'primary' application I am working with.
Even if I change the nID variable to something else, then the new variable name is 'already defined'. So, it isn't a variable redefinition problem.
Any ideas on this would by hugely appreciated.