PocketMatrix forums

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

Error when compiling for Pocket PC

I'm having a fantastic time developing with GapiDraw! I have been working with the sample application example outlined in the GapiDraw Documentation article titles "Creating a new project". The example compiles and runs perfectly on my desktop pc and my laptop. However, when I attempt to compile it for my pocket pc, I get the following error:

C:\Source\MyProject\Common\MyProject.cpp(29) : error C2731: 'WinMain' : function cannot be overloaded

C:\Source\MyProject\Common\MyProject.cpp(28) : see declaration of 'WinMain'


I believe I have followed the example instructions, and I'm reasonably sure the code is correct, as it runs on my stationary pcs. The same error occured with GapiDraw v. 1.04 and still occurs now that I am using v. 2.01b. I have tried compiling this on two different pc's with the same result. Sadly, I have only one ppc (Casio E-125), so that may be the problem...

Does anyone have any idea why this is happening and what I can do about it?
CpuWhiz105 · 28 May 2003, 01:01 UTC — Overloaded Functions
An overloaded function is when a function is decleared twice and with different arguments. For example, if I have the function:
int MyFunction(int i, long k);

and I have another function:
int MyFunction(int i);

that will be overloaded. You may have something like that going on with the WinMain function.
Hmmm... I'll have to check into my WinMain definition...

But, really, the problem I have is that I ONLY get this error when compiling for my PPC. The program compiles and runs perfectly on my stationary pc's. The code is exactly the same whether I'm compiling for my stationary pcs or my PPC. I don't know if it has something to do with my settings, with Embedded Visual C++, or my PPC... Well, I'll keep trying!
CpuWhiz105 · 28 May 2003, 21:32 UTC — WinMain
Here is what I get when I make a sample app for PPC and Windows:

Windows:
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

PPC:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)

It might have something to do with the arguments or the return type. Try swapping those out and see if it works.

The GapiDraw samples use this:
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPTSTR pCmdLine, int nCmdShow)

It appears to work with both.
Thanks for the advice! I now think that I have something wrong in my project settings. Somehow I'm trying to link to the wrong library... or SOMETHING. I can get all the samples to compile and run on my PPC, so that tells me that I've made a mistake somewhere.