Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Subject: WinMain in an own static lib -> _WinMain AT 16 undefined reference ?! ;.( From: "G.-B. Hauck" To: cygwin AT cygwin DOT com Content-Type: text/plain Message-Id: <1078340535.4312.9.camel@haux.local> Mime-Version: 1.0 Date: Wed, 03 Mar 2004 20:02:15 +0100 Content-Transfer-Encoding: 7bit X-LMT-BERLIN-MailScanner-Information: Please contact the ISP for more information X-LMT-BERLIN-MailScanner: Found to be clean X-IsSubscribed: yes Hi Gurus ! I have a problem with cygwin gcc (gcc version 3.3.1 cygwin-special) - i think that i just don't understand "ld" - so maybe someone can help me .... For my "Application-Framework" i need to put WinMain(...) in a lib - but it doesnt work - please take a look on a minimalistic example: /* winmain.cc */ #include extern "C" void NewEntry(); extern "C" int APIENTRY WinMain(HINSTANCE hI,HINSTANCE hPI, LPSTR lpCmdLine,int nCmdShow) { NewEntry(); return 0; } /* test.cc */ #include extern "C" void NewEntry() { MessageBox(NULL,"test","test",MB_OK); } ------------ making test.exe with: g++ -c winmain.cc g++ -c test.cc g++ -mwindows -mno-cygwin -o test.exe winmain.o test.o is ok -> running test.exe gives you a wonderfull MessageBox ... BUT: g++ -c winmain.cc g++ -c test.cc ar -rs libmaintest.a winmain.o g++ -mwindows -mno-cygwin -o test.exe test.o -L./ -lmaintest /usr/lib/gcc-lib/i686-pc-mingw32/3.3.1/../../../../i686-pc-mingw32/lib/libmingw32.a(main.o)(.text+0x9b):main.c: undefined reference to `_WinMain AT 16' collect2: ld returned 1 exit status Why ld can't find _WinMain AT 16 - nm -g libmaintest.a gives: winmain.o: U _NewEntry 00000000 T _WinMain AT 16 Calling the linker with my lib "before" test.o, i.e. g++ -mwindows -mno-cygwin -o test.exe -L./ -lmaintest test.o gives the same ... I'm hanging around for two days with this ;-( TIA and Thank You, Spasibo, Danke, Merci .... Georg -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/