执行link.exe时出错? [英] Error executing link.exe??

查看:153
本文介绍了执行link.exe时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该程序的功能是输出

句中最长的单词。


#include< stdio.H>

#include< string.H>

main()

{int alphabetic(char);

int longest(char [] );

int i;

char line [100];

printf(输入一行);

得到(行);

printf(最长的单词是:);

for(i =最长(行);字母(行[] i]); i ++)

printf("%c",line [i]);

}


int字母(字符c)

{if((c> ='''''&& c< =''z'')||(c> =''''''& ;& c< ='''Z''))

return(1);

else

return(0);

}


int longest(char string [])

{int alphabetic(char c);

int i,length = 0,len = 0,place,inaword = 0; / * inaword = 0指的是

"游标" (i = 0; i< = strlen(string); i ++)

{if(alpabetic(string [i]))不是一个字* /



{inaword = 1;

place = i;

len ++;}

else

{inaword = 0;

if(length< len)

{length = len;

place = i;

len = 0;

}

}

}

返回(地点);

}

但是当我尝试链接(visual c ++ 6)时,它说

链接......

c.obj:错误LNK2001:未解析的外部符号_alpabetic

Debug / c.exe:致命错误LNK1120:1未解析的外部

执行link.exe时出错。


我不明白为什么。谁能帮帮我?谢谢!

解决方案

su ***** **@gmail.com 写道:


这是'声明:


{int alphabetic (炭);



错误信息:


" linking ...

c.obj:错误LNK2001:未解析的外部符号_alpabetic


我不明白为什么。谁能帮帮我?谢谢!



我不是Thx,但我甚至可以注意到alpabetic和字母

不一样。


raashid bhatt写道:


你在另一个函数里面做什么人函数原型?

int alphabetic(char);

int longest(char []);



在另一个

函数中声明声明没有错。如果那个短名称u的人可以做到。


将它们带到主
之外



没有必要。


>

并在fucntion名称之前追加__cdecl



有名为__ cdecl的C编程语言中没有任何内容而且,即使

如果有的话,也与他的问题毫无关系,这只是简单的

拼错了他的标识符。

su*******@gmail.com 写道:


程序的功能是输出

句子中最长的单词。


#include< stdio.H> ;

#include< string.H>



这些不应该有资本H.


main()



那应该是int main(void)


{int alphabetic(char);

int longest(char []);

int i;

char line [100];

printf(" input one line") ;

得到(线);



永远不要使用获取。使用fgets(line,100,stdin)并将100更改为

命名常量。


printf("最长的单词是: ");

for(i =最长(行);字母(行[i]); i ++)

printf("%c",line [i ]);

}


int alphabetic(char c)

{if((c> =''a'' && c< =''z'')||(c> =''A''&& c< =''Z''))

return(1) ;

其他

返回(0);

}


int最长(char string [ ])

{int alphabetic(char c);

int i,length = 0,len = 0,place,inaword = 0; / * inaword = 0指的是

"游标" (i = 0; i< = strlen(string); i ++)

{if(alpabetic(string [i]))不是一个字* /




你在这里拼写出字母错误。

-

Ian Collins。


The function of the program is to output the longest word in a
sentence.

#include<stdio.H>
#include<string.H>
main()
{int alphabetic(char);
int longest(char []);
int i;
char line[100];
printf("input one line");
gets(line);
printf("the longest word is:");
for(i=longest(line);alphabetic(line[i]);i++)
printf("%c",line[i]);
}

int alphabetic(char c)
{if((c>=''a''&&c<=''z'')||(c>=''A''&&c<=''Z''))
return(1);
else
return(0);
}

int longest(char string[])
{int alphabetic(char c);
int i,length=0,len=0,place,inaword=0; /*inaword=0 refers to the
"cursor" is not in a word*/
for(i=0;i<=strlen(string);i++)
{if(alpabetic(string[i]))
{inaword=1;
place=i;
len++;}
else
{inaword=0;
if(length<len)
{length=len;
place=i;
len=0;
}
}
}
return(place);
}
But when i try to link(visual c++6), it said
"Linking...
c.obj : error LNK2001: unresolved external symbol _alpabetic
Debug/c.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe."

I don''t understand why.Can anyone help me? Thx!

解决方案

su*******@gmail.com wrote:

Here''s the declaration:

{int alphabetic(char);

And the error message:

"Linking...
c.obj : error LNK2001: unresolved external symbol _alpabetic

I don''t understand why.Can anyone help me? Thx!

I''m not "Thx", but even I can notice that "alpabetic" and "alphabetic"
are not the same.


raashid bhatt wrote:

what are u doing man function prototype inside another function?
int alphabetic(char);
int longest(char []);

There is nothing wrong with having a declaration inside another
function. If that fellow with the short name "u" can do it.

take them outside main

There is no need.

>
and append __cdecl before fucntion name

There is nothing in the C programming language named "__cdecl" and, even
if there were, it has nothing to do with his problem, which was simply
misspelling his identifier.


su*******@gmail.com wrote:

The function of the program is to output the longest word in a
sentence.

#include<stdio.H>
#include<string.H>

These shouldn''t have a capital H.

main()

That should be int main(void)

{int alphabetic(char);
int longest(char []);
int i;
char line[100];
printf("input one line");
gets(line);

Never, ever use gets. Use fgets(line, 100, stdin) and change 100 to a
named constant.

printf("the longest word is:");
for(i=longest(line);alphabetic(line[i]);i++)
printf("%c",line[i]);
}

int alphabetic(char c)
{if((c>=''a''&&c<=''z'')||(c>=''A''&&c<=''Z''))
return(1);
else
return(0);
}

int longest(char string[])
{int alphabetic(char c);
int i,length=0,len=0,place,inaword=0; /*inaword=0 refers to the
"cursor" is not in a word*/
for(i=0;i<=strlen(string);i++)
{if(alpabetic(string[i]))

You spelt alphabetic wrong here.
--
Ian Collins.


这篇关于执行link.exe时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆