All Forums
 Microsoft Windows CE
 eVC Application Development
 Starting from main() instead of WinMain()
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

ctacke

877 Posts

Posted - 03 Feb 2003 :  14:01:44  Show Profile  Email Poster
Q: I'm porting an old application from Windows 98 that starts in main with thie following signature:

void main( int argc, char *argv[], char *envp[] )


I cannot get my CE application to link. It always reports:
error LNK2019: unresolved external symbol WinMain referenced in function WinMainCRTStartup

How do I get my application to start up in main()?



Windows CE projects started with eVC default to an entry point of WinMain() but you can change this by following these steps:

  1. From the eVC manubar open the Project | Settings dialog.
  2. Select the Link tab
  3. Change the Category dropdown to "Output"
  4. Change the Entry-point symbol from "WinMainCRTStartup" to "main"

whuh

23 Posts

Posted - 03 Feb 2003 :  14:24:19  Show Profile  Email Poster
Actual parameters to main() will be same as WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)

To get command parameters, decode lpCmdLine.
Go to Top of Page

Joelw

30 Posts

Posted - 11 Feb 2003 :  14:22:52  Show Profile  Email Poster
It is easier to leave main() code intact and change Entry-point symbol from "WinMainCRTStartup" to "mainACRTStartup" ;-)

parsing main() argc with wrong entry-point yields an invalid number, but compiles ok.

Try to find this in the documentation!!
Go to Top of Page

ctacke

877 Posts

Posted - 03 Jun 2003 :  15:02:01  Show Profile  Email Poster
Also it is notable that this depends on the signature of you entry point.

If you're starting with:
int main(int argc, char *argv[])
then the entry point is mainACRTStartup

But if you're starting with:
int _tmain(int argc, TCHAR *argv[])
then the entry point is mainWCRTStartup

For more info take a look at this article.
Go to Top of Page
  Topic  
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.03 seconds. Snitz Forums 2000