学习C语言 遇到这个情况解决不了
aa.h 文件
void test();
aa.c 文件
#include "aa.h"
#include "stdio.h"
void test()
{
printf("test\n");
}
main.c文件
#include "aa.h"
#include "stdio.h"
void main(void)
{
test();
}
gcc main.c为什么test()未定义??
多文件编译需要把多个源代码文件都要给编译器。
编译命令应该是
gcc main.c aa.c -o a.exe
也可以
gcc *.c -o a.exe