![]() |
| | #1 |
| Registered User Join Date: Feb 2008 Location: Rochester, NY
Posts: 27
| Unresolved External Symbol So I have a Badger class which is binded to Lua via LuaBadger. Now what I have attempted to do is make a BadgerManager class which gets called when the Lua script attempts to create a new Badger. It checks to see if the Badger is already created then returns that Badger. Probably pointless and going about it the wrong way but I'm just kind of playing around at this point. Issue is that when I attempt to store and use a BadgerManager pointer in my LuaBadger class it is telling me unresolved external symbol. It has to be something with my use of static in the class. Although I'm apparently misunderstanding what I am doing. Any help on resolving the unresolved would be great. Thank! BadgerManager (part of SimpleLua.h) Code: class BadgerManager
{
public:
BadgerManager(){ };
~BadgerManager(){ };
Badger* GetBadger(const char* name)
{
Badger* b = 0;
list<Badger*>::iterator itr = badgerList.begin();
while(itr != badgerList.end())
{
if(strcmp(name, (*itr)->GetName()))
{
b = (*itr);
break;
}
}
if(!b)
{
(*b) = Badger(name);
}
return b;
};
private:
list<Badger*> badgerList;
};
Code: static BadgerManager* bm;
static int create_badger(lua_State* L)
{
Badger* b;
const char* name = luaL_checkstring(L, 1);
b = (Badger*)lua_newuserdata(L, sizeof(Badger));
luaL_getmetatable(L, className);
lua_setmetatable(L, -2);
//(*b) = Badger(name);
b = bm->GetBadger(name);
return 1;
}
|
| CornyKorn21 is offline | |
| | #2 |
| Registered User Join Date: Feb 2008 Location: Rochester, NY
Posts: 27
| Resolved the issue. Never initialized the LuaBadger::bm outside of the class definition. |
| CornyKorn21 is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compiling sample DarkGDK Program | Phyxashun | Game Programming | 6 | 01-27-2009 03:07 AM |
| C++ std routines | siavoshkc | C++ Programming | 33 | 07-28-2006 12:13 AM |
| Including lib in a lib | bibiteinfo | C++ Programming | 0 | 02-07-2006 02:28 PM |
| Stupid compiler errors | ChrisEacrett | C++ Programming | 9 | 11-30-2003 05:44 PM |
| debug to release modes | DavidP | Game Programming | 5 | 03-20-2003 03:01 PM |