ID: Q104244
7.00 | 1.00 1.50 MS-DOS | WINDOWS kbprg kbbuglist
The information in this article applies to:
- Microsoft C/C++ for MS-DOS, version 7.0
- Microsoft Visual C++ for Windows, versions 1.0 and 1.5
A communal (that is, global and uninitialized) structure declaration of a variable with the "volatile" type qualifier is not resolved at link time. The result is an unresolved external (L2029 error) on the declared variable. For example, if the following code
struct a { int x; } volatile v;
main() {
v.x=3;
}
is placed in a TEST.C file and is compiled with the default compiler
and linker options, the linker will return:
error L2029: '_v' : unresolved external
Use one of the following three workarounds:
-or-
struct a { x; } volatile v = { 3 };
-or-
struct a { x; };
struct a volatile v;
Microsoft has confirmed this to be a bug in C/C++ versions 7.0 and 8.0 for MS-DOS and C/C++ version 7.0 for OS/2. This problem does not occur with the Microsoft Visual C++ 32-bit edition.
Additional reference words: 1.00 1.50 1.00 7.00 8.00 8.00c KBCategory: kbprg kbbuglist KBSubcategory: CLIss Keywords : kb16bitonly
Last Reviewed: July 23, 1997