无法解析的外部符号,怎么看哪里错了

huanhuan30 2009-05-29 12:06:44

#include <stdio.h>
#include "stdafx.h"
#include <stdlib.h>
typedef int ElemType;
typedef struct node
{
ElemType coef;
ElemType exp;
struct node * next;
}Node;

Node *CreatLink(int n);
int main(void)
{
int la, lb;
Node *pA, *pB;
puts("Enter the length of pA and pB");
scanf("%d %d", &la, &lb);
pA = CreatLink(la);
pB = CreatLink(lb);
}

Node *CreakLink(int n)
{
int c;
int coe, ex;
Node * pHead, * pNew;
Node * pNode;
pNew = (Node *)malloc(sizeof(Node));
pHead = pNew;
pHead->next = NULL;
pNode = pHead;
for(c = 0; c < n; c++)
{
pNew = (Node *)malloc(sizeof(Node));
if(pNew == NULL)
exit(0);
pNode->next = pNew;
puts("Enter the coef and exp");
scanf("%d %d", &coe, &ex);
pNew->coef = coe;
pNew->exp = ex;
pNew->next = NULL;
pNode = pNew;
}
return pHead;
}

// 这东西哪里错了。。。
2.5 error LNK2019: 无法解析的外部符号 "struct node * __cdecl CreatLink(int)" (?CreatLink@@YAPAUnode@@H@Z) ,该符号在函数 _main 中被引用
2.5 fatal error LNK1120: 1 个无法解析的外部命令

谁能告诉我 struct node * __cdecl CreatLink(int)" (?CreatLink@@YAPAUnode@@H@Z) 这东西怎么看???


...全文
128 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
pengzhixi 2009-05-30
  • 打赏
  • 举报
回复
确认你这个函数的定义是否定义了,或者定义时函数头是否和声明的一致.
mymtom 2009-05-30
  • 打赏
  • 举报
回复
拼写错误

Node *CreakLink(int n)
// ==^==
{
int c;
}

// 改为

Node *CreatLink(int n)
// ==^==
{
int c;
}
b43ok 2009-05-30
  • 打赏
  • 举报
回复
遇到这种情况,引用一下LIB就行了
除非你的LIB跟你的DLL对不上号
光宇广贞 2009-05-29
  • 打赏
  • 举报
回复
C++函数调用规则和函数名修饰规则

楼主看看这个,说得已经是相当明白了。
KylinBL 2009-05-29
  • 打赏
  • 举报
回复
在C++中,编译包含函数定义或函数原型的源文件之后,可以获取函数名的修饰形式。你给出的CreatLink@@YAPAUnode@@H@Z就是struct node * __cdecl CreatLink(int)"的修饰名
zgjxwl 2009-05-29
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 huanhuan30 的回复:]
看出来了。。。。。 函数名字,写错了。。。谁能告诉我

struct node * __cdecl CreatLink(int)" (?CreatLink@@YAPAUnode@@H@Z) 这个提示怎么理解
[/Quote]
该函数经你的函数声明Node *CreatLink(int n);
编译为内部名字。。在main函数内部,使用了CreatLink函数,但是解析的时候,找不到该函数的定义。。。所以连接失败了。
zgjxwl 2009-05-29
  • 打赏
  • 举报
回复
Node *CreakLink(int n)

-->

Node *CreatLink(int n)
huanhuan30 2009-05-29
  • 打赏
  • 举报
回复
看出来了。。。。。 函数名字,写错了。。。谁能告诉我

struct node * __cdecl CreatLink(int)" (?CreatLink@@YAPAUnode@@H@Z) 这个提示怎么理解
huanhuan30 2009-05-29
  • 打赏
  • 举报
回复
struct node * __cdecl CreatLink(int)" (?CreatLink@@YAPAUnode@@H@Z) 这个提示 怎么理解.谢谢各位啦
pathuang68 2009-05-29
  • 打赏
  • 举报
回复
帮顶

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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