#ifndef RESMANAGER_H
#define RESMANAGER_H
#include <map>
#include <string>
#include "SDL.h"
class CResManager {
public:
static CResManager* get() {
return &instance;
}
protected:
CResManager(void);
virtual ~CResManager(void);
private:
static CResManager instance;
std::map<std::string, SDL_Surface*> images;
};
#endif
STL map problem
Hello, I'm a newbie using STL, and have been trying to setup a map for resource management within my game, but keep getting a linkage problem. Here is the code for the header file:
I thought it had something to do with the fact that I was storing pointers, but even a simpl std::map<std:string, std:string> gives an error.
Any help is appreciated.
Thanks.
I bet the linker is complaining about the static instance; "unresolved external" or some such.
steeg, your static CResManager instance; is only a declaration, you still need to add CResManager CResManager::instance; to some CPP file to define the variable.
steeg, your static CResManager instance; is only a declaration, you still need to add CResManager CResManager::instance; to some CPP file to define the variable.
Quote:Original post by Fruny
I bet the linker is complaining about the static instance; "unresolved external" or some such.
steeg, your static CResManager instance; is only a declaration, you still need to add CResManager CResManager::instance; to some CPP file to define the variable.
yes, I have that on my .cpp file, which is just blank right now:
#include "ResManager.h"CResManager CResManager::instance;CResManager::CResManager(void) {}CResManager::~CResManager(void) {}
and the error I am getting (say when I use std::map<std:string, std:string> is:
ResManager.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: bool __thiscall std::_Tree (and it goes on for lines and lines...)
Quote:Original post by steeg
and the error I am getting (say when I use std::map<std:string, std:string> is:
ResManager.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: bool __thiscall std::_Tree (and it goes on for lines and lines...)
This is a build settings issue. Creating a new project and copying your source files into it should fix it.
A quick [google] turns up people who have had the same problem (and had other less drastic possible solutions, if you have a bunch of custom build settings you'd rather not trash)
Or you can make sure that "Ignore All Default Libraries" is set to No (Project->Properties->Configuration Properties->Linker->Input).
jfl.
jfl.
Quote:Original post by Tradone
you can try gdb and do a stack trace.
He is having linker errors, not runtime errors.
Original post by steegQuote:Original post by FrunyAh. You aren't using VS2005 Express by chance, are you?
and the error I am getting (say when I use std::map<std:string, std:string> is:
ResManager.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: bool __thiscall std::_Tree (and it goes on for lines and lines...)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement