1

input.cファイル:

#include "input.h"
void file_processing( FILE *course_file, FILE *student_file )
{
    char buf[256], line[256];
    ........
}

input.hファイル:

#ifndef STUDENT_H
#define STUDENT_H

#include <string.h>

void process_command( char command[256] );

void file_processing( FILE *course_file, FILE *student_file );

#endif

main.cファイル:

#include "input.h"

int main( int argc, char *argv[] ){
    .........
    file_processing(course_file, student_file);
    ...
    return 0;
}

コンパイラは私にこのエラーを投げています:

main.c: In function ‘int main(int, char**)’:
main.c:53:46: error: ‘file_processing’ was not declared in this scope

誰でも私に何を見るべきかについてのヒントを与えることができますか?

更新: いくつかの追加のコーディングの後、別のエラーが発生します。

/tmp/ccJ4nsnm.o: In function `main':
main.c:(.text+0x1e5): undefined reference to `file_processing(_IO_FILE*, _IO_FILE*)'
collect2: ld returned 1 exit status
4

1 に答える 1

4

複数の包含保護がファイル名と一致しないのは興味深いと思います。

#ifndef STUDENT_H
#define STUDENT_H

これも含まれている別の.hファイルから取得しましたか?

于 2012-09-30T04:41:46.260 に答える