首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

一个程序连接有关问题!

2012-03-12 
一个程序连接问题!!!代码如下:#include iostreamusingstd::coutusingstd::endlstructBox{doublelength

一个程序连接问题!!!
代码如下:
#include <iostream>
using   std::cout;
using   std::endl;

struct   Box{
double   length;
double   width;
double   height;
};

double   volume(const   Box&   aBox);

int   main(){
Box   firstBox={80.0,50.0,40.0};
double   firstBoxVolume=volume(firstBox);
cout < <endl;
cout < < "Size   of   first   Box   object   is   "
< <firstBox.length < < "   by   "
< <firstBox.width < < "   by   "
< <firstBox.height
< <endl;
cout < < "Volume   of   first   Box   object   is   " < <firstBoxVolume
< <endl;
Box   secondBox=firstBox;
secondBox.length*=1.1;
secondBox.width*=1.1;
secondBox.height*=1.1;
cout < < "Size   of   second   Box   object   is   "
< <secondBox.length < < "   by   "
< <secondBox.width < < "   by   "
< <secondBox.height
< <endl;
cout < < "Volume   of   second   box   object   is   " < <volume(secondBox)
< <endl;
cout < < "Increasing   the   box   dimensions   by   10%   has   increased   the   volume   by   "
< <static_cast <long> ((volume(secondBox)-firstBoxVolume)*100.0/firstBoxVolume)
< < "% "
< <endl;
return   0;
}

double   volume(const   Box&   aBox){
return   aBox.length*aBox.width*aBox.height;
}

我用的是VC6,编译能通过,但连接却出问题,提示如下:
Linking...
LIBCD.lib(wincrt0.obj)   :   error   LNK2001:   unresolved   external   symbol   _WinMain@16
Debug/11_1.exe   :   fatal   error   LNK1120:   1   unresolved   externals
Error   executing   link.exe.

这是什么原因啊,请各位高手指点,谢谢!!!

[解决办法]
估计你在创建Project时选择的不是Win32 Console,而是Win32

热点排行