This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc Unicode and _WinMain@16

At 03:17 AM 6/1/2004, you wrote:
>I have a simple Windows app that I am building using gcc:
>gcc -c -Wall -mno-cygwin  app.cpp -o app.o
>windres -i resource.rc -o resource.o
>gcc  -Wall -mno-cygwin app.o -o app.exe resource.o -s -mwindows
>The app entry is:
>int WINAPI WinMain(HINSTANCE instance,HINSTANCE prevInstance,LPTSTR cmdLine,int cmdShow)
>This compiles,builds, and executes fine.
>However, I need to build a Unicode version of the app. The only change I made
>was to define UNICODE & _UNICODE before including windows.h. It compiles, but
>when linking I get the error:
>main.c: undefined reference to `_WinMain@16'
>If anyone can please help, it would be most appreciated.

This is really a question for the MinGW list at  You're using
the -mno-cygwin switch to gcc which means you're not using Cygwin.  By
definition, this fact makes the question off-topic for this list.  If 
you google around a bit though, you'll probably find out why you get this
problem.  Setting UNICODE changes the provided entry point to
wWinMainCRTStartup.  You'll need to specify this entry point explicitly 
in your link line to get it to build properly.

Larry Hall                    
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
838 Washington Street                   (508) 893-9889 - FAX
Holliston, MA 01746                     

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]