我有一段代码,我以前运行时没有问题。但是现在我要回去了,我什至无法编译它!
未编译的部分是 .c 文件,我认为它在抱怨库。
我尝试通过这样做来编译它:
gcc f.c
我得到:
In file included from /usr/include/machine/ansi.h:39:0,
from /usr/include/sys/ansi.h:35,
from /usr/include/stdio.h:42
from f.c:7:
/usr/include/machine/int_types.h:45:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
In file included from /usr/include/sys/inttypes.h:39:0,
from /usr/include/inttypes.h:36,
from /usr/include/netdb.h:98,
from f.c:9:
/usr/include/sys/stdint.h:39:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int8_t'
In file included from /usr/include/ara/inet.h:69:0,
from netlib.h:7,
from f.c:16:
/usr/include/netinet/in.h:242:2: error: expected specifier-qualifier-list before '__int8_t'
/usr/include/netinet/in.h:259:2: error: expected specifier-qualifier-list before '__int8_t'
这是我的 .c 文件:
#include <stdio.h>
#include <string.h>
#include <netdb.h>
#include <sys/socket.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "netlib.h"
#include <stdlib.h>
#define MACHSIZE 50
#define BUFFSIZE 256
#define MAXCONN 100
#define MAXFILES 500
#define COMBUFF 200
struct Connection{
int conn;
in_addr_t ip;
int port;
int numFilesOpened;
};
typedef struct Connection Connection;
Connection connection[MAXCONN];
struct Files{
int fid;
long machine;
int conn;
};
typedef struct Files Files;
Files files[MAXFILES];
int filesOpened = 0;
int port = 15061;
int numCli = 0;
char command[COMBUFF];
char response;
int conn;
char buffer[BUFFSIZE];
...
还有更多,但我认为它与图书馆有关,所以你可以帮助我。
有人能在这里看到什么吗?
另外,如果这很重要,我在 NetBSD 上这样做,但我在 FreeBSD 上尝试过,它是一样的。