我用VC++6输入一个简单程序,编译提示如下:
Compiling...
file1.cpp
D:\vc++6.0\MSDev98\MyProjects\y723\file1.cpp(7) : error C2065: 'f1' : undeclared identifier
D:\vc++6.0\MSDev98\MyProjects\y723\file1.cpp(11) : error C2373: 'f1' : redefinition; different type modifiers
D:\vc++6.0\MSDev98\MyProjects\y723\file1.cpp(14) : error C2065: 'f2' : undeclared identifier
D:\vc++6.0\MSDev98\MyProjects\y723\file1.cpp(18) : error C2373: 'f2' : redefinition; different type modifiers
程序如下:
#include<iostream.h>
extern int a;
void main(void)
{
a++;
cout<<a<<endl;
f1();
}
int a=0;
void f1()
{
a++;
cout<<a<<endl;
f2();
}
void f2()
{
a++;
cout<<a<<endl;
}
希望高手給一個解釋,謝謝~