读书人

下面是一个c++程序小弟我在vc6.0中编

发布时间: 2012-05-24 11:55:41 作者: rapoo

下面是一个c++程序,我在vc6.0中编译通过了,链接出现了unresolved external symbol _WinMain@16的错误,请高人指点,谢谢
#include<string>
#include<iostream>

int main()
{
using namespace std;
const char *pszConstString="Hello String!";
cout<<"Constant string is: "<<pszConstString<<endl;

std::string strFromConst(pszConstString);
cout<<"strFromConst is: "<<strFromConst<<endl;

std::string str2 ("Hello string!");
std::string str2Copy (str2);
cout<<"str2Copy is: "<<str2Copy<<endl;

std::string strPartialCopy (pszConstString,5);
cout<<"strPartialCopy is: "<<strPartialCopy<<endl;

std::string strRepeatChars (10,'a');
cout<<"strRepeatChar is: "<<strRepeatChars<<endl;

return 0;
}

[解决办法]
项目类型设错了http://www.cnitblog.com/ictfly/archive/2007/01/17/21976.aspx
[解决办法]
_WinMain 这个应该是Window程序 楼主你的main 是console程序。。你看下是不是工程类型不对了

读书人网 >C++

热点推荐