BUG: Class Export with Inline Constructor Causes L2022Last reviewed: July 22, 1997Article ID: Q114153 |
1.00 1.50 1.51 1.52
WINDWOS
kbtool kbbuglist
The information in this article applies to:
SYMPTOMSIf class _export syntax is used on a class with virtual functions and all constructors are inline then the virtual function table definition will not be placed in the OBJ file. If the below sample is compiled and linked it will generate the following error: LINK : error L2022: ??_7CTest@@6B@ : export undefined
CAUSEThe error is caused because the symbol definition has not been placed in the .OBJ file, but an EXPDEF record has been generated which references it. Note that this problem will occur whether you use the _inline format for your constructors or you use the "implied _inline" C++ syntax of defining the constructor in your class declaration, for example: class _export CTest { CTest() {};}; The L2022 error will be caused any time an EXPDEF error is created and no definition exists. This will happen when you use "class _export <name>" with either the /GD or with /GA and /GEe.
RESOLUTIONProvide at least one constructor which is NOT inline.
STATUSMicrosoft 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. This is not an issue with the 32-bit compiler.
MORE INFORMATION
Sample Code
/* Compile options needed:Default for a non-MFC Windows DLL (uses /GD) */class _export CTest { CTest(); virtual void vfunc1() {};};
// Remove the '_inline' in the following line to // prevent the error._inline CTest::CTest() { };
|
Additional reference words: 1.00 1.50 8.00 8.00c COMDAT
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |