c - OpenBSD 6.1 termio.h : No such file or directory

标签 c autotools automake bsd

我尝试使用 OpenBSD 6.1 构建我的代码,但我收到此错误消息。

sh.h:98:20: error: termio.h: No such file or directory
In file included from edit.c:1:
sh.h:235: error: conflicting types for 'rlim_t'
/usr/include/sys/types.h:145: error: previous declaration of 'rlim_t' was here
In file included from edit.c:1:
sh.h:2291: warning: 'struct termio' declared inside parameter list
sh.h:2291: warning: its scope is only this definition or declaration, which is probably not what you want
edit.c: In function 'x_mode':
edit.c:3256: error: invalid use of undefined type 'struct termio'
edit.c:3256: error: 'VERASE' undeclared (first use in this function)
edit.c:3256: error: (Each undeclared identifier is reported only once
edit.c:3256: error: for each function it appears in.)
edit.c:3256: error: invalid use of undefined type 'struct termio'
edit.c:3257: error: invalid use of undefined type 'struct termio'
edit.c:3257: error: 'VKILL' undeclared (first use in this function)
edit.c:3257: error: invalid use of undefined type 'struct termio'
edit.c:3258: error: invalid use of undefined type 'struct termio'
edit.c:3258: error: 'VINTR' undeclared (first use in this function)
edit.c:3258: error: invalid use of undefined type 'struct termio'
edit.c:3259: error: invalid use of undefined type 'struct termio'
edit.c:3259: error: 'VQUIT' undeclared (first use in this function)
edit.c:3259: error: invalid use of undefined type 'struct termio'
edit.c:3260: error: invalid use of undefined type 'struct termio'
edit.c:3260: error: 'VEOF' undeclared (first use in this function)
edit.c:3260: error: invalid use of undefined type 'struct termio'
edit.c:3293: error: 'TCSETAW' undeclared (first use in this function)
*** Error 1 in src (Makefile:774 'edit.o')
*** Error 1 in . (Makefile:834 'all-recursive')
*** Error 1 in /root/opsh (Makefile:750 'all')
# pkg_add termios
quirks-2.304 signed on 2017-04-02T15:01:33Z
Can't find termios
# pkg_add termios 
# termios
ksh: termios: not found
# termio
ksh: termio: not found
# pkg_add libc6-dev
quirks-2.304 signed on 2017-04-02T15:01:33Z
Can't find libc6-dev
# pkg_add libc6     
quirks-2.304 signed on 2017-04-02T15:01:33Z
Can't find libc6
# 

我该怎么办?代码使用 Ubuntu 1604 编译。

最佳答案

<termio.h> header 不是标准的,即使它在 Linux 上可用。标准 header 是 POSIX <termios.h> .

在我的 Ubuntu 16.04 LTS VM 镜像上,该文件完整包含:

/* Compatible <termio.h> for old `struct termio' ioctl interface.
   This is obsolete; use the POSIX.1 `struct termios' interface
   defined in <termios.h> instead.  */

#include <termios.h>
#include <sys/ioctl.h>

如果您使用非标准 header ,您可能不会在其他系统上找到它们。您可以自己创建一个 <termio.h> 的副本使用以上信息。您可能幸运地发现 BSD <sys/ioctl.h> (它确实存在)包含你需要的信息——如果有的话——但它不是 POSIX 标准化的 header ,所以所有的赌注都没有了。如果您只使用 <termios.h> 中的标准符号,你应该是安全的。

关于c - OpenBSD 6.1 termio.h : No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45626921/

相关文章:

c - C中局部变量的自动初始化

makefile - 如何从 autotools 生成的 makefile 中删除 -Werror?

c - 为 ARM 发布交叉编译 apr-1.5.2

autotools - 分发自动工具图元文件

c++ - 将带有 automake 的预构建二进制文件放在哪里?

c - "char"类型的参数与 char* 类型的参数不兼容

c - Linux调度。 (线程)

c - 外部文件中的扩展模块/组文档

linux - 为什么 "autoreconf"不经常使用?

c++ - '-std=c++11' 对 C++/ObjC++ 有效,但对 C 无效