c语言初学,在主程序中调用顺序表的接口函数时,出现 LNK2019 无法解析的外部符号 SeqListInit,函数 TestSeqlist1 中引用了该符号 Project1 C:\Users\admin\source\repos\Project1\Project1\Test.obj ;
```c
#include "seqlist.h"
void TestSeqlist1()
{
SL sl;
SeqListInit(&sl);
}
int main()
{
return 0;
}
头文件如下
```c
#pragma once
#include
#include
#include<assert.h>
typedef int SLDataType;
//动态数组(顺序表)
typedef struct Seqlist
{
SLDataType* a;
int size;//表示数组存储了多少个数据;
int capacity;//表述数组实际能存数据的空间容量是多大;
}SL;
//接口函数
void SeqListInit(SL* ps);//初始化
void SeqListPushBack(SL* ps, SLDataType x);//尾插
void SeqListPopBack(SL* ps, SLDataType x);//尾删
void SeqListPopFront(SL* ps, SLDataType x);//头删
void SeqListPushFront(SL* ps, SLDataType x);//头插
void SeqListDestory(SL* ps, SLDataType x);//销毁
void SeqListCheckCapacity(SL* ps, SLDataType x);//检查capacity容量,不够就增容
void SeqListInsert(SL* ps, SLDataType x);//插入,首先检查容量,然后定位最后插入,然后数组大小加1;注意越界和死循环
void SeqListErase(SL* ps, SLDataType x);//删除
size_t SeqListSize(SL* ps);//返回数组大小
size_t SeqListFind(SL* ps,SLDataType x);//返回x值的下标
SLDataType SeqListAt(SL* ps,SLDataType x);//返回某个位置的值
void SeqListRemove(SL* ps, SLDataType x);//删除指定值的结点
void SeqlistModify(SL* ps,SLDataType x);//删除指定位置的值
void SeqListPrint(SL* ps);//打印顺序表
void SeqListBubbleSort(SL* ps);//冒泡排序
void SeqListBinaryFind(SL* ps, SLDataType x);//顺序表的二分查找
接口函数的.cpp文件可以正常编译,就不贴了,所以我的问题出现在哪?使用的时vs2022
解决方法: