C++ 我错过了什么?未定义引用

C++ 我错过了什么?未定义引用,c++,compiler-errors,undefined-reference,C++,Compiler Errors,Undefined Reference,到现在为止,我已经编程了7个小时了,我真的看不到这个问题,因为我已经精疲力竭了。我需要一些额外的眼睛 为什么这段代码不编译 bool readFromFile(const char*, Graph[5]); bool writeToFile(Graph[5]); int main(int argc, char* argv[]) { . . . Graph graph[5]; if(readFromFile(argv[1], graph) == fals

到现在为止,我已经编程了7个小时了,我真的看不到这个问题,因为我已经精疲力竭了。我需要一些额外的眼睛

为什么这段代码不编译

bool readFromFile(const char*, Graph[5]);
bool writeToFile(Graph[5]);

int main(int argc, char* argv[]) {
    .
    .
    .

    Graph graph[5];
    if(readFromFile(argv[1], graph) == false){    //read and error check
        cout << "Returning from main(). . ." << endl;
        return -1;
    }

    if(writeToFile(graph) == false){
        cout << "Returning from main(). . ." << endl;
        return -1;
    }

    return 0;
}

bool writetoFile(Graph graph[5]){
    FILE* fp;
    fp = fopen("output2.txt","w");
    if(fp == NULL){
        cout << "Error opening file: output2.txt" << endl;
        return false;
    }

    //count pairs
    int pairCount[5] = {0};


    fclose(fp);
    return true;
}
当我尝试使用g编译时也是如此++

/tmp/ccM7A6te.o: In function `main':
main.cpp:(.text+0x187): undefined reference to `writeToFile(Graph*)'
collect2: error: ld returned 1 exit status

注意:我会尽快删除这个问题,谢谢您的关注。

您在调用函数时在原型和代码中命名了函数
writeToGraph()
,但在定义函数时将其命名为
writeToGraph()
(注意大小写的差异)


因此,它没有链接。

您键入了:
writetoFile
,而不是函数定义中的
writetoFile

好的,您可以删除您的答案,以便我可以删除帖子吗?非常感谢…为什么要删除它?Camel case吸引了很多疲惫的程序员,包括我自己。将它留给正在搜索“undefined netbeans compile”的其他人。没错。。。我不是这么想的,我的意思是我肯定有很多这样的例子,所以我想删除它。没关系,反正可以留着。我想在遇到这样一个错误后,我会再次切换到使用下划线:)
/tmp/ccM7A6te.o: In function `main':
main.cpp:(.text+0x187): undefined reference to `writeToFile(Graph*)'
collect2: error: ld returned 1 exit status