Sign in to follow this  
Zeraan

Linking .h/.cpp files

Recommended Posts

ok here's the problem, I feel like a noobie... anyway here it is: I made a D3D engine, along with DInput, so that it'd handle the basic stuff that I need, a long time ago (due to me serving a mission). So I came back home and set MS Visual C++ 6.0, and DirectX 8.1 SDK, and set up everything. Now the problem is, I tried to start a new project, but it gave me errors. The background info: My engine is called Outpost engine, and it's located in a folder called Outpost also... It's in the same directory as my game project. It has the following includes:
#include <d3d8.h>
#include <d3dx8.h>
#include <dinput.h>
#include <dplay8.h>
#include <dpaddr.h>

#include "OutpostG.h" //Graphics
#include "OutpostI.h" //Input
in the OutpostG.h, it has a class for handling all the D3D stuff, and if I render something, I render through it. Anyway, when I try to declare that class in my project, it gave me error, saying that its undefined.
WinMain.obj : error LNK2001: unresolved external symbol "public: __thiscall TOutpost_Graphic::TOutpost_Graphic(void)" (??0TOutpost_Graphic@@QAE@XZ)
What am I doing wrong? More details needed?

Share this post


Link to post
Share on other sites
I see your compiled file WinMain.cpp includes the Outpost header files so that should be ok. Have you added the Outpost source files (in which the declared classes in the Outpost header files are defined) by clicking:
Project, Add to project, Files..., and then inserted the cpp-files?
Or are your class's member functions entirely defined in the header files?

\Jimmy H

Share this post


Link to post
Share on other sites
Unresolved external means that it can't find the code. It's been declared somewhere (in your header files), but it can't find the .cpp files to go with it. You may have forgotten to add in a project file, try importing the .cpp/.lib file that goes with that header into the project, then try linking it again.

[edit] Beaten. It took me two minutes to write THAT?! ^^

Share this post


Link to post
Share on other sites
Thanks for your responses! I found that out also... So I'm now rebuilding the engine, and fixing the bugs in process (I'm not typing it all over, just copy and pasting codes) The way I did it was sloppy and unprofessional, so now I'm making it more professional and neat. :)

Thanks. I'll keep in mind that "unresolved" means "can't find" ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this