BUG: Link Fails w/ Unresolved External When Call SWAP.H (123780)
The information in this article applies to:
- Microsoft Visual C++, Macintosh Cross-Development Addon 4.0b
This article was previously published under Q123780 SYMPTOMS
When calling the functions defined in SWAP.H from a C++ program, the link
fails with an unresolved external, such as this one:
TEST.OBJ : error LNK2001: unresolved external symbol
"?CbFreeSwapMem@@YCJJ@Z (long __pascal CbFreeSwapMem(long))"
TEST.OBJ : error LNK2001: unresolved external symbol
"?SetMaxSwapSize@@YAXK@Z (void __cdecl SetMaxSwapSize(unsigned long))"
MacDebug/TEST.exe : error LNK1120: 2 unresolved externals
CAUSE
The header file (SWAP.H) in the MSVC20\M68K\INCLUDE directory is missing
the necessary extern "C" block around the swap function declarations.
RESOLUTION
Surround the include of SWAP.H with an extern "C" block, as in this
example:
extern "C"
{
#include <swap.h>
}
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. We are researching this problem and will
post new information here in the Microsoft Knowledge Base as it becomes
available.
Modification Type: | Major | Last Reviewed: | 2/11/2002 |
---|
Keywords: | kbbug kbLangCPP KB123780 |
---|
|