Главная страница | назад





Article #16964: Unresolved external _errno

 Question and Answer Database
FAQ1964C.txt Unresolved external _errno
Category :C/C++ Language Issues
Platform :All
Product :BC++ 5.x
Question:
I'm using this library I got from someone, and when
I use certain functions, I get an "unresolved external _errno"
that doesn't go away when I attempt to define errno directly.
What is going on?
Answer:
Errno is a global variable used by C runtime library functions
to store error information when they return with an error
condition. In a multithreaded application, each thread
requires its own copy of _errno; as a result, _errno is
defined differnetly depending in an application which uses
the thread-supporting RTL than it is in an application which
does not use the multithreaded version of the library.
When you are linking a module which does not use the
multithreaded RTL with a third-party library which does,
or vice versa, you can get errors of this type, because
of the difference in the definitions caused by use of
the compiler define __MT__.
The linker error can be eliminated by either (a) using the
multithreaded library when you are linking to libraries
which use the multithreaded library or (b) not using
the multithreaded library when you are linking to libraries
which use the single-threaded library.
However, it is worth noting that solving the linker error
may not be sufficient to guarantee correct behavior on
the part of your program.
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99