C 结构问题

C 结构问题,c,web,struct,C,Web,Struct,这是我正在开发的网络搜索引擎的一部分。基本上,我试图存储在索引URL上找到的所有单词,以及单词出现的次数。当然,我制作了一个结构来存储这两个东西。在函数indexystuff I中,为结构及其内容指定malloc空间。然后我继续将其传递给printTrieContents,后者负责将数据添加到结构中。我得到了这些错误:我只包括这两个函数,以避免一个疯狂的长篇大论 aldrbw01@timber:~/project5$ make gcc -g -c indexPage.c -o indexPage

这是我正在开发的网络搜索引擎的一部分。基本上,我试图存储在索引URL上找到的所有单词,以及单词出现的次数。当然,我制作了一个结构来存储这两个东西。在函数indexystuff I中,为结构及其内容指定malloc空间。然后我继续将其传递给printTrieContents,后者负责将数据添加到结构中。我得到了这些错误:我只包括这两个函数,以避免一个疯狂的长篇大论

aldrbw01@timber:~/project5$ make
gcc -g -c indexPage.c -o indexPage.o
In file included from indexPage.c:12:
indexPage.h:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
indexPage.c:77: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
indexPage.c: In function ‘indexMyStuff’:
indexPage.c:147: error: dereferencing pointer to incomplete type
indexPage.c:148: error: dereferencing pointer to incomplete type
indexPage.c:152: error: void value not ignored as it ought to be
indexPage.c: At top level:
indexPage.c:263: error: conflicting types for ‘printTrieContents’
indexPage.c:151: note: previous implicit declaration of ‘printTrieContents’ was here
indexPage.c: In function ‘printTrieContents’:
indexPage.c:291: error: too few arguments to function ‘printTrieContents’
make: *** [indexPage.o] Error 1

typedef结构字控制查询帮助;
结构字控制{
字符**字;
国际*国家;
};
queryHelper*indexMyStuff(char*argv){
结构queryhelp*myStruct=malloc(sizeof(struct wordControl)*1);
myStruct->words=malloc(sizeof(char*)*100);
myStruct->countArry=malloc(sizeof(int)*100);
trieIndex_t*myTrie=indexPage(argv);
printTrieContents(myTrie,“,myStruct);
返回freeTrieMemory(myTrie);
}
queryHelper*printTrieContents(trieIndex\u t*pNode,char oldBuffer[MAX\u WORD\u SIZE],queryHelper*结构){
//字母计数器
int i=0;
//包含连接字符串的新缓冲区
char newBuffer[最大字大小];
//现在,让我们一步一步地浏览每个角色。值得注意的是
//将按字母顺序工作,因为代码从0-25开始计数,并且
//每个字母作为从a=0到z=25的映射存储在字符数组中,
//这将自动按比例顺序显示它们。
对于(i=0;ichildren[i]!=NULL){
//现在,我们将字符连接到现有字符串的末尾
snprintf(新缓冲区,最大字大小,“%s%c”,旧缓冲区,intToAlpha(i));
//如果当前字符串实际上是在索引中找到的单词
//过程中,我们将在此处打印它,以及
//索引函数找到了这个词。
如果(pNode->children[i]->count>0){
结构->单词[i]=newBuffer;
结构->countArry[i]=pNode->children[i]>count;
}
//循环遍历所有字符,直到到达每个字符的叶子
//其中一个分支。
printTrieContents(pNode->children[i],newBuffer);
}
}
回报结构;
}
//-----------------------------头文件--------------------------------------//
#ifndef指数
#定义索引
#包括
#包括
#包括
#包括
queryhelp*indexMyStuff(char*argv);
#恩迪夫
看那一行:

queryHelper *indexMyStuff(char* argv);
queryHelper是什么?编译器不知道。这是错误的消息,但这是因为编译器不知道它是什么类型。您需要将typedef移动到标题(该行上方)

下一个错误是:

indexPage.c:77: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
你没有包括那一行(或者告诉我们是哪一行),所以我们无法在这方面帮助你

indexPage.c: In function ‘indexMyStuff’:
indexPage.c:147: error: dereferencing pointer to incomplete type
indexPage.c:148: error: dereferencing pointer to incomplete type
indexPage.c:152: error: void value not ignored as it ought to be


不要添加
struct

初始编译器错误在indexPage.h中。请提供此文件并说明它是如何包含的/我只是在底部包含了它。在为该id提供任何定义之前,请自问编译器在编译标头时如何知道
queryhelp
是什么?
indexPage.c:77: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
indexPage.c: In function ‘indexMyStuff’:
indexPage.c:147: error: dereferencing pointer to incomplete type
indexPage.c:148: error: dereferencing pointer to incomplete type
indexPage.c:152: error: void value not ignored as it ought to be
struct queryHelper *myStruct = malloc(sizeof(struct wordControl)*1); 
myStruct->words=malloc(sizeof(char*)*100);
myStruct->countArry=malloc(sizeof(int)*100);