From: colin AT fu DOT is DOT saga-u DOT ac DOT jp (Colin Peters) Subject: RE: Getting Started, 'errno' problem 24 Oct 1998 09:10:26 -0700 Message-ID: <002c01bdfef8$49c90fe0$fa173185.cygnus.gnu-win32@gbird0.fu.is.saga-u.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit To: "Stephen E. Schweibinz" Cc: "GNU-win32" Stephen E. Schweibinz wrote: [snip] >When I try to run 'make', I keep getting an undefined reference >to 'errno'. > >libpbm.a(libpbm1.o)(.text+0x4e8):libpbm1.c: undefined reference to `errno' >collect2: ld returned 1 exit status >make: *** [pbmmerge] Error 1 Have you tried looking at libpbm1.c? Specifically I wonder if perhaps the file contains code like this: extern int errno; /* ... other code ... */ if (errno == EFOO) /* or something like that */ Basically the problem *might* be that libpbm1.c is assuming that errno is an ordinary external variable. Unfortunately since errno is in a DLL under Cygwin32 (IIRC) it isn't, and you have to include errno.h and use the declaration you get from there (which is probably a macro). This would work on systems where errno really is just an external int. I have a vague recollection that the error you get if you include the proper header file but don't link with libcygwin.a is slightly different, leading underscores and stuff like that. This is just a guess. [snip] >Including -lc or -lg produces the following error: > >C:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\ >egcs-2.91.57\..\..\..\..\i386-cygwin32\lib/libcygwin.a(l >ibccrt0.o)(.data+0x0):libccrt0.cc: multiple definition of >`_impure_ptr' >C:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\ >egcs-2.91.57\..\..\..\..\i386-cygwin32\lib/libg.a >(impure.o)(.data+0x2ec):impure.c: first defined here >collect2: ld returned 1 exit status >make: *** [pbmmerge] Error 1 Apparently you are linking libcygwin.a, so you don't need to link libc or libg (I would think). Colin. - Colin Peters - colin at fu.is.saga-u.ac.jp - http://www.geocities.com/Tokyo/Towers/6162/index.html - Go not to usenet for counsel, for it will say both - 'yes' and 'no' and 'try another newsgroup'. - 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".