Problem resolved!
Quite embarassing but:
I forgot to allocate the Game instance
m_pGame = new Game(); fixed it.
I have a STL list which I know is empty, but I still do as always and write a for-loop that looks like this:
Code:
typedef list<shared_ptr<Player> > PlayerList;
class Game
{
public:
bool Init(class NetworkManager* pNm);
bool Update(unsigned int deltaMilli);
void OnClientConnect(shared_ptr<class Socket> pSocket);
protected:
PlayerList m_Players;
};
bool Game::Update(unsigned int deltaMilli)
{
for (PlayerList::iterator i = m_Players.begin(); i != m_Players.end(); ++i) //Crash!
{
(*i)->Update(deltaMilli);
}
return true;
}
At the line commented crash, the application crashes due to memory access violation in the list. I have used similar code many times before with sucess and I am very confused why this isn't working anymore. I have also tried with a vector and the same results showed up.
Error message:
Code:
Unhandled exception at 0x0000000140014c65 in Application.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff.
I have no compilation warnings, but this linker warning:
Code:
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
The project is built under 64-bits debug mode.
Would really appreciate some help on this tough one as I am completely clueless.
Thanks in advance
Regards
Daniel