|
#include<iostream>
using namespace std;
int k=1;
int main()
{
int i=4;
int fun(int);
fun(i);
cout<<"(1)"<<i<<','<<k<<endl;
return 0;
}
void fun(int m)
{
m+=k;
k+=m;
{
char k='B';
cout<<"(2)"<<char(k-'A')<<endl;
}
cout<<"(3)"<<m<<','<<k<<endl;
}
这个程序编译通过,
为什么运行的时候,会出现:
--------------------Configuration: Cpp1 - Win32 Debug--------------------
Linking...
Cpp1.obj : error LNK2001: unresolved external symbol "int __cdecl fun(int)" (?fun@@YAHH@Z)
Debug/Cpp1.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
Cpp1.exe - 1 error(s), 0 warning(s)
怎么回事? |
|