Linking .h/.cpp files

Started by
2 comments, last by Zeraan 18 years, 10 months ago
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?
Advertisement
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
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?! ^^
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" ;)

This topic is closed to new replies.

Advertisement