I am working on a wrapper for an already existent ResourceManager. I don't know why it isn't working. I get no errors if I have the code in the class definition(inline), but when I changed it to an imp file. I get the following.
Code:
1>------ Rebuild All started: Project: MalignantTrials, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'MalignantTrials', configuration 'Debug|Win32'
1>Compiling...
1>MalignantTrials.cpp
1>ResourceMgr.cpp
1>SHge.cpp
1>StateMgr.cpp
1>Debug.cpp
1>Generating Code...
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Linking...
1>ResourceMgr.obj : error LNK2019: unresolved external symbol "public: void * __thiscall hgeResourceManager::GetResource(char const *,int)" (?GetResource@hgeResourceManager@@QAEPAXPBDH@Z) referenced in function "public: void * __thiscall ResourceMgr::GetResource(char const *)" (?GetResource@ResourceMgr@@QAEPAXPBD@Z)
1>ResourceMgr.obj : error LNK2019: unresolved external symbol "public: unsigned long __thiscall hgeResourceManager::GetTexture(char const *,int)" (?GetTexture@hgeResourceManager@@QAEKPBDH@Z) referenced in function "public: unsigned long __thiscall ResourceMgr::GetTexture(char const *)" (?GetTexture@ResourceMgr@@QAEKPBD@Z)
1>ResourceMgr.obj : error LNK2019: unresolved external symbol "public: unsigned long __thiscall hgeResourceManager::GetEffect(char const *,int)" (?GetEffect@hgeResourceManager@@QAEKPBDH@Z) referenced in function "public: unsigned long __thiscall ResourceMgr::GetEffect(char const *)" (?GetEffect@ResourceMgr@@QAEKPBD@Z)
1>ResourceMgr.obj : error LNK2019: unresolved external symbol "public: unsigned long __thiscall hgeResourceManager::GetMusic(char const *,int)" (?GetMusic@hgeResourceManager@@QAEKPBDH@Z) referenced in function "public: unsigned long __thiscall ResourceMgr::GetMusic(char const *)" (?GetMusic@ResourceMgr@@QAEKPBD@Z)
1>ResourceMgr.obj : error LNK2019: unresolved external symbol "public: unsigned long __thiscall hgeResourceManager::GetStream(char const *,int)" (?GetStream@hgeResourceManager@@QAEKPBDH@Z) referenced in function "public: unsigned long __thiscall ResourceMgr::GetStream(char const *)" (?GetStream@ResourceMgr@@QAEKPBD@Z)
1>ResourceMgr.obj : error LNK2019: unresolved external symbol "public: class hgeStringTable * __thiscall hgeResourceManager::GetStringTable(char const *,int)" (?GetStringTable@hgeResourceManager@@QAEPAVhgeStringTable@@PBDH@Z) referenced in function "public: class hgeStringTable * __thiscall ResourceMgr::GetStringTable(char const *)" (?GetStringTable@ResourceMgr@@QAEPAVhgeStringTable@@PBD@Z)
1>C:\Documents and Settings\Raigne\My Documents\Visual Studio 2008\Projects\MalignantTrials\Debug\MalignantTrials.exe : fatal error LNK1120: 6 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Raigne\My Documents\Visual Studio 2008\Projects\MalignantTrials\MalignantTrials\Debug\BuildLog.htm"
This is the class.
Code:
#pragma once
#include "SHge.h"
#include <hgeResource.h>
#include <hge.h>
#include <hgesprite.h>
#include <hgeanim.h>
#include <hgefont.h>
#include <hgeparticle.h>
#include <hgedistort.h>
#include <hgestrings.h>
#include <string>
class ResourceMgr
{
public:
ResourceMgr()
{rsMgr = new hgeResourceManager("Data\\MasterScript.res");};
~ResourceMgr()
{delete rsMgr;};
void* GetResource(const char* name);
HTEXTURE GetTexture( const char* name );
HEFFECT GetEffect( const char* name );
HMUSIC GetMusic( const char* name );
HSTREAM GetStream( const char* name );
HTARGET GetTarget( const char* name );
hgeSprite* GetSprite( const char* name);
hgeAnimation* GetAnimation( const char* name);
hgeFont* GetFont( const char* name);
hgeParticleSystem* GetParticleSystem( const char* name);
hgeDistortionMesh* GetDistortionMesh( const char* name);
hgeStringTable* GetStringTable( const char* name);
void Purge(int resgroup);
static ResourceMgr& Ref()
{
if (!Singleton)
{
std::cout << "\nCreating ResourceMgr...";
Singleton = new ResourceMgr;
std::cout << "Done.\n\n";
}
return *Singleton;
};
static void Free()
{
if (Singleton)
{
std::cout << "\nFreeing ResourceMgr...";
delete Singleton;
Singleton = 0;
std::cout << "Done.\n\n";
}
};
private:
static ResourceMgr* Singleton;
hgeResourceManager* rsMgr;
};
Here is the imp
Code:
#include "ResourceMgr.h"
ResourceMgr* ResourceMgr::Singleton = 0;
void* ResourceMgr::GetResource(const char* name)
{
void* TempResource = 0;
std::cout << "\n\nLoading Resource: " << name << '\n';
if ( hge::Ref().Get() )
{
TempResource = rsMgr->GetResource(name);
if ( TempResource == 0 )
{
std::cout << "-->Failed to load Resource.\n\n";
std::string t = "Could not load Raw Resource: ";
t += name;
MessageBoxA(0,t.c_str(),"Error",MB_OK);
return 0;
}
std::cout << "-->Successfully load Resource.\n\n";
return TempResource;
}
std::cout << "-->Bad HGE pointer.\n\n";
return 0;
};
HTEXTURE ResourceMgr::GetTexture( const char* name )
{
HTEXTURE TempTexture = 0;
std::cout << "\n\nLoading Texture: " << name << '\n';
if ( hge::Ref().Get() )
{
TempTexture = rsMgr->GetTexture(name);
if ( TempTexture == 0 )
{
std::cout << "-->Failed to load Texture.\n\n";
std::string t = "Could not load Texture: ";
t += name;
MessageBoxA(0,t.c_str(),"Error",MB_OK);
return 0;
}
std::cout << "-->Successfully loaded Texture.\n\n";
return TempTexture;
}
std::cout << "-->Bad HGE pointer.\n\n";
return 0;
};
HEFFECT ResourceMgr::GetEffect( const char* name )
{
HEFFECT TempEffect = 0;
std::cout << "\n\nLoading Effect: " << name << '\n';
if ( hge::Ref().Get() )
{
TempEffect = rsMgr->GetEffect(name);
if ( TempEffect == 0 )
{
std::cout << "-->Failed to load Effect.\n\n";
std::string t = "Could not load Effect: ";
t += name;
MessageBoxA(0,t.c_str(),"Error",MB_OK);
return 0;
}
std::cout << "-->Successfully loaded Effect.\n\n";
return TempEffect;
}
std::cout << "-->Bad HGE pointer.\n\n";
return 0;
};
HMUSIC ResourceMgr::GetMusic( const char* name )
{
HMUSIC TempMusic = 0;
std::cout << "\n\nLoading Music: " << name << '\n';
if ( hge::Ref().Get() )
{
TempMusic = rsMgr->GetMusic(name);
if ( TempMusic == 0 )
{
std::cout << "-->Failed to load Music.\n\n";
std::string t = "Could not load Music: ";
t += name;
MessageBoxA(0,t.c_str(),"Error",MB_OK);
return 0;
}
std::cout << "-->Successfully loaded Music.\n\n";
return TempMusic;
}
std::cout << "-->Bad HGE pointer.\n\n";
return 0;
};
HSTREAM ResourceMgr::GetStream( const char* name )
{
HSTREAM TempStream = 0;
std::cout << "\n\nLoading Stream: " << name << '\n';
if ( hge::Ref().Get() )
{
TempStream = rsMgr->GetStream(name);
if ( TempStream == 0 )
{
std::cout << "-->Failed to load Stream.\n\n";
std::string t = "Could not load Stream: ";
t += name;
MessageBoxA(0,t.c_str(),"Error",MB_OK);
return 0;
}
std::cout << "-->Successfully loaded Stream.\n\n";
return TempStream;
}
std::cout << "-->Bad HGE pointer.\n\n";
return 0;
};
HTARGET ResourceMgr::GetTarget( const char* name )
{
HTARGET TempTarget = 0;
std::cout << "\n\nLoading Render Target: " << name << '\n';
if ( hge::Ref().Get() )
{
TempTarget = rsMgr->GetTarget(name);
if ( TempTarget == 0 )
{
std::cout << "-->Failed to load Target.\n\n";
std::string t = "Could not load Render Target: ";
t += name;
MessageBoxA(0,t.c_str(),"Error",MB_OK);
return 0;
}
std::cout << "-->Successfully loaded Target.\n\n";
return TempTarget;
}
std::cout << "-->Bad HGE pointer.\n\n";
return 0;
};
hgeSprite* ResourceMgr::GetSprite( const char* name)
{
hgeSprite* TempSprite = 0;
std::cout << "\n\nLoading Sprite: " << name << '\n';
if ( hge::Ref().Get() )
{
TempSprite = rsMgr->GetSprite(name);
if ( TempSprite == 0 )
{
std::cout << "-->Failed to load Sprite.\n\n";
std::string t = "Could not load Sprite: ";
t += name;
MessageBoxA(0,t.c_str(),"Error",MB_OK);
return 0;
}
std::cout << "-->Successfully loaded Sprite.\n\n";
return TempSprite;
}
std::cout << "-->Bad HGE pointer.\n\n";
return 0;
};
hgeAnimation* ResourceMgr::GetAnimation( const char* name)
{
hgeAnimation* TempAnimation = 0;
std::cout << "\n\nLoading Animation: " << name << '\n';
if ( hge::Ref().Get() )
{
TempAnimation = rsMgr->GetAnimation(name);
if ( TempAnimation == 0 )
{
std::cout << "-->Failed to load Animation.\n\n";
std::string t = "Could not load Animation: ";
t += name;
MessageBoxA(0,t.c_str(),"Error",MB_OK);
return 0;
}
std::cout << "-->Successfully loaded Animation.\n\n";
return TempAnimation;
}
std::cout << "-->Bad HGE pointer.\n\n";
return 0;
};
hgeFont* ResourceMgr::GetFont( const char* name)
{
hgeFont* TempFont = 0;
std::cout << "\n\nLoading Font: " << name << '\n';
if ( hge::Ref().Get() )
{
TempFont = rsMgr->GetFont(name);
if ( TempFont == 0 )
{
std::cout << "-->Failed to load Font.\n\n";
std::string t = "Could not load Font: ";
t += name;
MessageBoxA(0,t.c_str(),"Error",MB_OK);
return 0;
}
std::cout << "-->Successfully loaded Font.\n\n";
return TempFont;
}
std::cout << "-->Bad HGE pointer.\n\n";
return 0;
};
hgeParticleSystem* ResourceMgr::GetParticleSystem( const char* name)
{
hgeParticleSystem* TempParticleSystem = 0;
std::cout << "\n\nLoading ParticleSystem: " << name << '\n';
if ( hge::Ref().Get() )
{
TempParticleSystem = rsMgr->GetParticleSystem(name);
if ( TempParticleSystem == 0 )
{
std::cout << "-->Failed to load ParticleSystem.\n\n";
std::string t = "Could not load ParticleSystem: ";
t += name;
MessageBoxA(0,t.c_str(),"Error",MB_OK);
return 0;
}
std::cout << "-->Successfully loaded ParticleSystem.\n\n";
return TempParticleSystem;
}
std::cout << "-->Bad HGE pointer.\n\n";
return 0;
};
hgeDistortionMesh* ResourceMgr::GetDistortionMesh( const char* name)
{
hgeDistortionMesh* TempDistortionMesh = 0;
std::cout << "\n\nLoading DistortionMesh: " << name << '\n';
if ( hge::Ref().Get() )
{
TempDistortionMesh = rsMgr->GetDistortionMesh(name);
if ( TempDistortionMesh == 0 )
{
std::cout << "-->Failed to load DistortionMesh.\n\n";
std::string t = "Could not load DistortionMesh: ";
t += name;
MessageBoxA(0,t.c_str(),"Error",MB_OK);
return 0;
}
std::cout << "-->Successfully loaded DistortionMesh.\n\n";
return TempDistortionMesh;
}
std::cout << "-->Bad HGE pointer.\n\n";
return 0;
};
hgeStringTable* ResourceMgr::GetStringTable( const char* name)
{
hgeStringTable* TempStringTable = 0;
std::cout << "\n\nLoading StringTable: " << name << '\n';
if ( hge::Ref().Get() )
{
TempStringTable = rsMgr->GetStringTable(name);
if ( TempStringTable == 0 )
{
std::cout << "-->Failed to load StringTable.\n\n";
std::string t = "Could not load StringTable: ";
t += name;
MessageBoxA(0,t.c_str(),"Error",MB_OK);
return 0;
}
std::cout << "-->Successfully loaded StringTable.\n\n";
return TempStringTable;
}
std::cout << "-->Bad HGE pointer.\n\n";
return 0;
};
void ResourceMgr::Purge(int resgroup)
{
rsMgr->Purge(resgroup);
}
These error's don't make sense to me. I was hoping someone here could give some insight to my problem. Thank you.