这些不应该有资本H. 那应该是int main(void) 永远不要使用获取。使用fgets(line,100,stdin)并将100更改为 命名常量。 你在这里拼写出字母错误。 - Ian Collins。 The function of the program is to output the longest word in asentence.#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);elsereturn(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 _alpabeticDebug/c.exe : fatal error LNK1120: 1 unresolved externalsError executing link.exe."I don''t understand why.Can anyone help me? Thx! 解决方案And the error message:I''m not "Thx", but even I can notice that "alpabetic" and "alphabetic"are not the same.There is nothing wrong with having a declaration inside anotherfunction. If that fellow with the short name "u" can do it.There is no need.There is nothing in the C programming language named "__cdecl" and, evenif there were, it has nothing to do with his problem, which was simplymisspelling his identifier.These shouldn''t have a capital H.That should be int main(void)Never, ever use gets. Use fgets(line, 100, stdin) and change 100 to anamed constant.You spelt alphabetic wrong here.--Ian Collins. 这篇关于执行link.exe时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-28 21:44