大家帮帮忙。出现entry point must be defined

ufdxkm 2009-02-09 04:39:57
Compiling...
new.cpp
Linking...
LINK : fatal error LNK1561: entry point must be defined

我用vs2005
出现上面错误
这是代码,看不出哪里有错误啊。


#include <iostream>

template <typename T>
T showarray(T arr[],int n);

template <typename T>
T showarray(T *arr[],int n);

struct debts
{
char name[50];
double amount;
};
int mian()
{
using namespace std;
int things[6]={13,31,103,301,310,130};
struct debts mr_e[3]=
{
{"Ima Wolfe",2400.0},
{"Ura Foxe",1300.0},
{"Iby Stout",1800.0}
};
double *pd[3];

for(int i=0;i<3;i++)
pd[i]=&mr_e[i].amount;

cout<<"Listing Mr.E's couts of things: \n";
cout<<"total"<<showarray(things,6); //use templateA
cout<<"Listing Mr.E's debts: \n";
cout<<"total"<<showarray(pd,3);//tamplateB
return 0;
}

template <typename T>
T showarray(T arr[],int n)
{
using namespace std;
cout<<"template A\n";
T total=0;
for(int i=0;i<n;i++)
total=total+arr[i];
return total;
}
template <typename T>
T showarray(T *arr[],int n)
{
using namespace std;
cout<<"template B\n";
T total=0;
for(int i=0;i<n;i++)
total=total+ *arr[i];
return total;
}


Thanks !
...全文
513 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ufdxkm 2009-02-09
  • 打赏
  • 举报
回复
怎么阿 晕死啦 确实错啦 不好意思。。
jiangheng2008 2009-02-09
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 dizuo 的回复:]
int main()

main拼写错。。。
[/Quote]

%$&^#&
ufdxkm 2009-02-09
  • 打赏
  • 举报
回复
只建一个cpp文件 就是上边那个
或者代码哪里有错误?
ryfdizuo 2009-02-09
  • 打赏
  • 举报
回复
int mian()
{
ryfdizuo 2009-02-09
  • 打赏
  • 举报
回复
int main()

main拼写错。。。
ufdxkm 2009-02-09
  • 打赏
  • 举报
回复
emptyproj
taodm 2009-02-09
  • 打赏
  • 举报
回复
你建的什么工程啊?

65,211

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧