TITLE: Another difference between C and C++ PROBLEM: wchen@neptune.calstatela.edu (weidong chen) I test the a small program in Visual C++ 1.51: File pub.c: int message[256]; int number_1, int number_2; File t.c: extern int message[]; extern int number_1; extern int number_2; void main() { number_1 = 0; ... } The first file is compiled into a library called "pub.lib", and when I link the second file's "t.obj" with "pub.lib" into "t.exe", MicroSoft C compiler complains that "_message", "_number_1" and "_number_2" are all "Unresolved externals". RESPONSE: clamage@Eng.Sun.COM (Steve Clamage), 21 June 95 I notice the files are called ".c". Are they being compiled as C or as C++ modules? The rules for extern variables are different in the two languages. In C, int number_1; /* at file scope */ is a declaration, not a definition. You need to add an explicit initializer to make it a definition. Some C implementations will accept the program without definitions, some will not. The C standard says the results are undefined if you don't provide a definition, meaning the program can be rejected by the compiler or linker. In C++, int number_1; // at file scope is a definition, even without an initializer.