From: Keith M. <kei...@us...> - 2014-03-06 18:36:05
|
On 06/03/14 17:51, Cleverson Casarin Uliana wrote: > I'm studying Charles Petzold's book, Programming Windows fifth edition. So far I've successfully compiled the example codes in chapters 1 and 2, but I'm unable to compile chapter 3's code. It displays the following error messages: > > C:\DOCUME~1\ccasarin\CONFIG~1\Temp\ccyCdFBL.o:HelloWin.c:(.text+0x67): undefined > reference to `_GetStockObject@4' > C:\DOCUME~1\ccasarin\CONFIG~1\Temp\ccyCdFBL.o:HelloWin.c:(.text+0x1d9): undefine > d reference to `_PlaySoundA@12' > collect2.exe: error: ld returned 1 exit status > > I'm using the most recent Mingw version available at the web site. My OS is Windows XP. The command I issue to compile is: > cc HelloWin.c -o HelloWin -s You need: cc -mwindows hellowin.c -o hellowin.exe -s -lwinmm The -mwindows gets you the GDI references, such as GetStockObject; -lwinmm is for PlaySound, (which I learned by reading http://msdn.microsoft.com/en-us/library/windows/desktop/dd743680%28v=vs.85%29.aspx to see which library is needed). -- Regards, Keith. |