From: gusel AT ise DOT ch (Gusel Bischoff) Subject: __errno() function is missing 18 Jan 1998 15:50:20 -0800 Message-ID: <34BFAA2A.642F.cygnus.gnu-win32@ise.ch> Reply-To: gusel AT ise DOT ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: gnu-win32 AT cygnus DOT com I am trying to compile tree-4.1(Tcl/Tk extension), the build crashes at the link stage. Here is the error message: ../src/libTkTree.a(error.o)(.text+0x17e):error.cc: undefined reference to `__errno(void) ../src/libTkTree.a(error.o)(.text+0x188):error.cc: undefined reference to `__errno(void) ../src/libTkTree.a(error.o)(.text+0x29c):error.cc: undefined reference to `__errno(void) ../src/libTkTree.a(error.o)(.text+0x2f4):error.cc: undefined reference to `__errno(void) g++: Internal compiler error: program ld got fatal signal 1 Is this function missing or do I need to add special libraries? Here is the Error.c file ------------------ begin --------------------------------- #include #include #include #include #include #include #include "error.h" // static variable holding text of last error messages static char errmsg_[1024]; // error code (see defines in for values) static int errno_ = 0; // optional error handler, to be called with error message static void (*errhandler_)(const char*) = NULL; /* * global error reporting routine */ int error(const char* msg1, const char* msg2, int code) { char buf[sizeof(errmsg_)]; ostrstream os(buf, sizeof(buf)); os << msg1 << msg2 << ends; if (errhandler_) (*errhandler_)(buf); #ifdef DEBUG cerr << "debug: " << buf << endl; #endif errno_ = code; strcpy(errmsg_, buf); return ERROR; } /* * report the error, including system error code */ int sys_error(const char* msg1, const char* msg2) { extern int sys_nerr; extern char *sys_errlist[]; extern int errno; if (errno < 0 || errno >= sys_nerr) return error(msg1, msg2); char buf[sizeof(errmsg_)]; ostrstream os(buf, sizeof(buf)); os << msg1 << msg2 << ": " << sys_errlist[errno] << ends; if (errhandler_) (*errhandler_)(buf); #ifdef DEBUG cerr << "debug: " << buf << endl; #endif errno_ = errno; strcpy(errmsg_, buf); return ERROR; } /* * return the text of the previous error message */ char* last_error() { return errmsg_; } /* * return the error code for the previous error */ int last_error_code() { return errno_; } /* * reset the last_error buf to empty */ void clear_error() { errmsg_[0] = '\0'; } /* * set a routine to be called with the text of error messages * when they occur. The argument is a pointer to an error * handler: * * void errhandler(const char* msg); * * The return value is a pointer to the previous error handler, or NULL, * if none was defined. */ void (*set_error_handler(void (*errhandler)(const char*)))(const char*) { void (*old_handler)(const char*) = errhandler_; errhandler_ = errhandler; return old_handler; } /* * print the given message on stderr (may be used as an error * handler) */ void print_error(const char* msg) { cerr << msg << endl; } ------------------------ end --------------------------------------- Any help is appreciated. TIA Gusel Bischoff - 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".