当我尝试编译我的简单启动程序时,我收到以下错误:
In file included from processcommand.c:1:
processcommand.h:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
processcommand.c:3: error: conflicting types for 'getinput'
processcommand.h:3: error: previous declaration of 'getinput' was here
processcommand.c: In function 'getinput':
processcommand.c:8: warning: return makes integer from pointer without a cast
processcommand.c: At top level:
processcommand.c:12: error: conflicting types for 'printoutput'
processcommand.h:4: error: previous declaration of 'printoutput' was here
我的代码文件是: main.c
#include "main.h"
int main() {
float version = 0.2;
printf("Qwesomeness Command Interprepter version %f by Zeb McCorkle starting...\n", version);
printf("%s", getcommand());
}
主文件
#include "includes.h"
int main();
包括.h
#include <stdio.h>
#include <string.h>
进程命令.c
#include "processcommand.h"
getinput() {
char *output;
printf(" ");
scanf("%s", output);
return output;
}
printoutput(char *input) {
printf("%s", input);
return 0;
}
getcommand() {
printoutput("Command:");
return getinput();
}
进程命令.h
#include "includes.h"
char *getinput();
unsigned char printoutput(char *input);
char *getcommand();
我相信这些都是我的源文件。我编译了
gcc main.c processcommand.c
谢谢您阅读此篇。