数据结构编译出错

[复制链接]
查看11 | 回复6 | 2021-1-27 05:26:44 | 显示全部楼层 |阅读模式
不知道哪错了,很难受


分 -->
回复

使用道具 举报

千问 | 2021-1-27 05:26:44 | 显示全部楼层
不贴编译结果就没得意思了
回复

使用道具 举报

千问 | 2021-1-27 05:26:44 | 显示全部楼层
引用1楼飞奔的小强sky的回复:不贴编译结果就没得意思了
小白,第一次发帖,不懂规矩


回复

使用道具 举报

千问 | 2021-1-27 05:26:44 | 显示全部楼层
引用1楼飞奔的小强sky的回复:不贴编译结果就没得意思了
小白,第一次发帖,不懂规矩


回复

使用道具 举报

千问 | 2021-1-27 05:26:44 | 显示全部楼层
你是不是该写个入口点main函数
回复

使用道具 举报

千问 | 2021-1-27 05:26:44 | 显示全部楼层
写了一个进去,编译没问题了,连接有问题,百度了许久也没解决,还望大神指点。
//顺序表的创建
#include
#include
usingnamespacestd;
constintMaxSize=100;
template
intmain()
{
classShunxulist
{
public:
Shunxulist();//建立空顺序表
Shunxulist(DataTypea[],intn);//建立长度为n的顺序表
~Shunxulist();//析构函数
voidprintlist();
private:
DataTypedata[MaxSize];//存放数组元素的数组
intLength;//线性表的长度
};
Shunxulist::Shunxulist(DataTypea[],intn)
{
cout>>"请输入顺序表长度:">>'\n';
cin>>n>>'\n';
if(n>MaxSize)throw"参数非法";
for(inti=0;i::printlist()
{
for(inti=0;i<Length;i++)
{
cout<<data<<'\n';
}
}
return0;
}


--------------------Configuration:7顺序链表-Win32Debug--------------------
Linking...
LIBCD.lib(crt0.obj):errorLNK2001:unresolvedexternalsymbol_main
Debug/7顺序链表.exe:fatalerrorLNK1120:1unresolvedexternals
执行link.exe时出错.
回复

使用道具 举报

千问 | 2021-1-27 05:26:44 | 显示全部楼层
这都什么嘛,main前面怎么会写template?你class怎么会写在main里面呢?你看看书上的范例怎么写的
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行