我正在尝试将三个文件一起编译,在 passweb.c 中有一个主要方法。
继承人 passweb.c
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <cipher.c>
#include <menu.c>
long pointer;
char *createRecord(char *name, char *password, char *type);
char *file = "password.csv";
int main(int argc, char *argv[]){
if(fopen(file,"r")==NULL){
FILE *newFile = fopen(file,"w+");
fclose(newFile);
}
if(strcmp(argv[0],"-menu")==1){
menu();
}
else if(strcmp(argv[0],"-add")==1){
add(argv[1], argv[2], argv[3]);
}
else if(strcmp(argv[0],"-edit")==1){
edit(argv[1],argv[2],argv[3],argv[4],argv[5],argv[6]);
}
}
和密码.c
#include <stdio.h>
#include <stdlib.h>
int Encrypt(char *fileName){
int offset=5;
Shift(fileName, offset);
}
int Decrypt(char *fileName){
int offset=-5;
Shift(fileName, offset);
}
生成文件:
passweb: passweb.c menu.c cipher.c
gcc -o passweb passweb.c menu.c cipher.c -I.
错误:
passweb.c:10: error: conflicting types for ‘main’
./cipher.c:3: error: previous definition of ‘main’ was here
我无法弄清楚我做错了什么。提前感谢您的宝贵时间!!