当前位置: 技术问答>linux和unix
各位帮帮忙看下了。<sys/termios.h>居然没包含有, 为什么啊?
来源: 互联网 发布时间:2016-06-22
本文导语: 1 #include "apue.h" 2 #include 3 #include 4 #include 5 6 #define MAXADDRLEN 256 7 #define BUFLEN 128 8 9 extern int connect_retry(int, const struct sockaddr *, s...
1 #include "apue.h"
2 #include
3 #include
4 #include
5
6 #define MAXADDRLEN 256
7 #define BUFLEN 128
8
9 extern int connect_retry(int, const struct sockaddr *, socklen_t);
10
11 void print_uptime(int sockfd)
12 {
13 int n;
14 char buf[BUFLEN];
15 while((n = recv(sockfd, buf, BUFLEN, 0))>0)
16 write(STDOUT_FILENO, buf, n);
17 if(n ai_next)
41 {
42 if((sockfd = socket(aip->ai_family, SOCK_STREAM, 0)) ai_addr, aip->ai_addrlen) cc -c uptime.c -o uptime.o
"apue.h", line 10.10: 1506-296 (S) #include file not found.
"uptime.c", line 24.12: 1506-007 (S) "struct addrinfo" is undefined.
"uptime.c", line 40.42: 1506-285 (S) The indirection operator cannot be applied to a pointer to an incomplete struct or union.
"uptime.c", line 42.33: 1506-285 (S) The indirection operator cannot be applied to a pointer to an incomplete struct or union.
"uptime.c", line 44.38: 1506-285 (S) The indirection operator cannot be applied to a pointer to an incomplete struct or union.
"uptime.c", line 44.52: 1506-285 (S) The indirection operator cannot be applied to a pointer to an incomplete struct or union.
"uptime.c", line 56.62: 1506-276 (S) Syntax error: possible missing ')'?
ZC_APP:idep:/settle1/idep/fuxx/unixadvance>
是我的系统没有那头文件吗?? 如果是的话我应该怎样加入啊???
|
哦,在/usr/include/sys下也有termios.h,内容为:
可见用的是/usr/include下的termios.h。在sys下提供termios.h应该是为了向后兼容吧。这是我系统上的情况,我用的是Ubuntu 8.04。
#ifndef _SYS_TERMIOS_H
#define _SYS_TERMIOS_H
#include
#endif
可见用的是/usr/include下的termios.h。在sys下提供termios.h应该是为了向后兼容吧。这是我系统上的情况,我用的是Ubuntu 8.04。
|
Linux下是
|
在apue.h里面把头文件改了,或者直接在开头加上
#include
#include