Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reference 对我定义的函数的未定义引用_Reference_Undefined - Fatal编程技术网

Reference 对我定义的函数的未定义引用

Reference 对我定义的函数的未定义引用,reference,undefined,Reference,Undefined,当我在readDPDA()函数声明中调用readTransition()函数时,我得到链接器错误:未定义引用。 如何在另一个函数的声明中使用我定义的函数 #include <stdio.h> #include <stdlib.h> #include <string.h> void readTransitionRules(char * temp); void readDPDA(char * filename); int main() { // i

当我在
readDPDA()
函数声明中调用
readTransition()
函数时,我得到
链接器错误:未定义引用
。 如何在另一个函数的声明中使用我定义的函数

 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

 void readTransitionRules(char * temp);
 void readDPDA(char * filename);
int main()
{
  // irrelevant
}

 void readTransitionRules(char * temp)
 {
char *tempToken;
tempToken=strtok(temp," ,:");
int i;
for(i=0; i<5; i++)
{
    printf("%s",tempToken);
    strtok(NULL," ,:");
 }
   }
 void readDPDA(char * filename)
 {
/*This function tries to open DPDA text file to read
states,alphabet,stack symbols and transition rules
of the DPDA that we will use as Word Checker.     */
extern void readTransitionRules(char * temp);

char * temp;

FILE * readerForDPDA;
readerForDPDA = fopen(filename,"r");
if(readerForDPDA!=NULL)
{
    fgets(temp,30,readerForDPDA);
    if(temp[0]=='T')
    {
        readTransitionRule(temp);
    }
}
else
{

}
}
#包括
#包括
#包括
void readTransitionRules(char*temp);
void readDPDA(字符*文件名);
int main()
{
//无关的
}
void readTransitionRules(char*temp)
{
char*Tentoken;
TENTROKEN=strtok(温度,“,:”);
int i;

对于(i=0;i您正在调用
readTransitionRule
,但您的函数名为
readTransitionRules


您可能有一个关于隐式函数声明的警告。不要忽略警告。

ReadDPDA
中,您指的是
readTransitionRule
,而不是您定义的
readTransitionRules
。您缺少字母
s

谢谢@zch,实际上是的,我有这个警告,但我想我正在这么做其他东西有问题。此代码不在main.c中,但在另一个.c文件中。我认为错误与此相关。感谢您的输入。我想当时我是瞎了眼。