From: colin AT bird DOT fu DOT is DOT saga-u DOT ac DOT jp (Colin Peters) Subject: RE: Linking for GUI's 10 Jul 1997 23:41:22 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <01BC8DE7.EFA41140.cygnus.gnu-win32@gbird0> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Original-To: "'GNU-Win32'" Original-Sender: owner-gnu-win32 AT cygnus DOT com Not much return mail is going to get to you with this address vvvvvvvvvvvvvvvvvvvvvv nicole nowell[SMTP:defaultuser AT domain DOT com] wrote: >Hi all, I have a very simple question that I can't seem to find on the >archives or the FAQ. I am trying to learn win32 programming with the >Nuts and Bolts Book by Schildt. Whenever I try to build the first >example it compiles fine, but the linker cannot resolve any of the Win32 >Api functions. The faq only says the most common functions are linked >and you may need to link other libraries. What libraries should I add >to the gcc line to build GUI apps (I have successfully compiled several >simple standard C and C++ programs with mains but no WinMain into >console apps). Under Cygnus GNU-Win32 you have to use the -mwindows option to compile GUI applications, and that will include user32 and gdi32 (as well as kernel32, which is always included). The Minimalist GNU-Win32 has similar behavior when the -windows flag is used. You can also manually link in these two libraries like so: gcc -o foo.exe foo.o bar.o -luser32 -lgdi32 -Wl,--subsystem,windows This should compile a GUI program and the two extra libraries will resolve most of the calls made by a standard Windows program. More unusual functions are grouped into one of the many libxxx.a import libraries for the Win32 API (I can't remember which directory they're in, but it's the same one as libkernel32.a, libuser32.a and libgdi32.a). Although it is unpleasant, you can use nm and grep to search for functions which you can't locate: nm libxxx.a | grep FunctionName Will display a match for an import library generally only if the given function is located in the library. Anyway, that's a start, good luck. Colin. -- Colin Peters - Saga Univ. Dept. of Information Science -- colin AT bird DOT fu DOT is DOT saga-u DOT ac DOT jp - finger for PGP public key -- http://www.fu.is.saga-u.ac.jp/~colin/index.html -- http://www.geocities.com/Tokyo/Towers/6162/ - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".