PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Including GapiDrawApplicatio.hn more than once

Hi there,

I used the tutorial from the web page to set my project up. No problem there.

I prefer to have code in .cpp files and class definations in .h files.

So I took the CMyApplication and split it into those two files. At the same time I removed it from the file where I have the WinMain.

In my header file I include CapiDrawApplication.h. My header file is included a few time also.

So now I get linker errors saying things like:
MyOwnApp.obj : error LNK2005: "public: __thiscall CGapiApplication::CGapiApplication(struct _GDAPPCONFIG const &)" (??0CGapiApplication@@QAE@ABU_GDAPPCONFIG@@@Z) already defined in MyProject.obj

This is probably due to that the header file CapiDrawApplication.h holds all the code to the system.

What solutions do I have ? Should I split CapiDrawApplication also ?
Easiest solution: Leave the file as it is .. :) If you use templates you always put all code in the .h files anyway (you can split it but VS6 has several issues with this)...

/Johan
Sam Nova · 18 Jul 2002, 17:30 UTC — Will not work
So you suggest I leave the CMyApplication together with WinMain and also add all my code into the header file !!

(I never used templates anyway).

So if I want to add a class that needs to know about CMyApplication then I have a serious problem, right ?
So it is NOT possible to include "GapiDrawApplication.h" more than once in a project !!!
:cry:

Well, I took the file and moved all the code into a .cpp file. Worked fine in first try. :D