请帮帮忙!谢谢!
#include <stdio.h>#include <malloc.h>
#include <stdlib.h>
typedef struct Node
{
int data;
struct Node * pNext;
}NODE, *PNODE;
PNODE create_list(void);
void traverse_list(PNODE pHead);
int main(void)
{
PNODE pHead = NULL;
pHead = create_list();//create_list():创建一个单链表
traverse_list(pHead);
return 0;
}
PNODE creat_list(void)
{
int len;
int i;
int val;
PNODE pHead= (PNODE)malloc(sizeof(NODE));//生成一个头结点
if(NULL == pHead)
{
printf("分配失败,程序终止!");
exit(-1);
}
PNODE pTail = pHead;
pTail->pNext = NULL;
printf("请输入需要生成的链表节点的个数:len = ");
scanf("%d", &len);
for (i = 0; i<len; i++)
{
printf("请输入第%d个节点的值:", i+1);
scanf("%d", &val);
PNODE pNew= (PNODE)malloc(sizeof(NODE));
if(NULL == pNew)
{
printf("分配失败,程序终止!");
exit(-1);
}
pNew->data = val;
pTail->pNext = pNew;
pNew->pNext = NULL;
pTail = pNew;
}
return pHead;
}
void traverse_list(PNODE pHead)
{
PNODE p = pHead->pNext;
while(NULL != p)
{
printf("%d", p->data);
p = p->pNext;
}
printf("\n");
return;
}
编译的时候没有出错,进行下一步build时,出了这样一个:
list.obj : error LNK2001: unresolved external symbol "struct Node * __cdecl create_list(void)" (?create_list@@YAPAUNode@@XZ)
Debug/list.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
请问是是什么原因呢?