是这样的,作者创建了一个C的项目,想在test.c中调用game.c的函数,却显示未定义,而在之前建的项目中却不会报错,这是为什么?
test.c
#include
int main()
{
choose();
return 0;
}
game.h
#include
#include
#include
#include
void choose();
game.c
#include"game.h"
void choose() {
int a;
scanf("%d",&a);
switch(a) {
case 1:
game();
break;
case 2:
break;
default:
printf("选择无效!请重新选择!\n");
choose();
}
}
以上三个单元均在同一项目中,省略了大部分代码
编译时
test.c里面包含了game.h吗 就是说有没有#include "game.h"
你有添加声明嘛
https://blog.csdn.net/deng19936/article/details/101967928
test里面是不是导个头文件
我其他项目里test.c也没有#include<game.h>,但是能够正常运行,就这个不行,不清楚为什么