第一步,创建一个工程 WIN32 APPLICATION
然后创建一个文件 C++ SOURCE FILE
然后输入
#include <string>
#include <iostream>
using namespace std;void main()
{
string a;
cin>>a;
cout<<a<<endl;
}
编译执行,发生错误:
error LNK2001: unresolved external symbol _WinMain@16
Debug/a.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.然后关闭VC,从文件夹双击X.cpp打开刚才的文件,编译运行通过。
这是为什么啊?
然后创建一个文件 C++ SOURCE FILE
然后输入
#include <string>
#include <iostream>
using namespace std;void main()
{
string a;
cin>>a;
cout<<a<<endl;
}
编译执行,发生错误:
error LNK2001: unresolved external symbol _WinMain@16
Debug/a.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.然后关闭VC,从文件夹双击X.cpp打开刚才的文件,编译运行通过。
这是为什么啊?
#include <iostream>
using namespace std;
int WinMain(HINSTANCE,HINSTANCE,TCHAR *,int)
{
string a;
cin>>a;
cout<<a<<endl;
return 0;
}
记得初学的时候都建的这个 呵呵
Debug/a.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错. 我发生这个错误是一般是运行一个程序后没有关闭
接着再运行一次