我正在做一个我认为需要使用termios.h
的应用程序,但我安装了Windows10。我安装了cygwin64。我在终端中输入gcc test.c -o test.exe
。我仍然得到fatal error: termios.h: No such file or directory #include <termios.h>
是否有我必须在安装过程中做的事情?
代码只是打印hello world,但我包含了termios.h
#include <stdio.h>
#include <termios.h>
int main(){
printf("Hello World!");
return 0;
}
发布于 2021-05-04 13:30:04
安装缺少的开发包。要找出哪个是,请使用cygcheck
$ cygcheck -p usr/include/termios.h
Found 12 matches for usr/include/termios.h
cygwin-devel-3.0.7-1 - cygwin-devel: Core development files
...
cygwin-devel-3.2.0-0.1 - cygwin-devel: Core development files
cygwin-devel-3.2.0-1 - cygwin-devel: Core development files
...
您需要cygwin-devel
$ cygcheck -l cygwin-devel |grep termios.h
/usr/include/termios.h
/usr/include/machine/termios.h
/usr/include/sys/termios.h
看看你的例子
$ cat prova.c
#include <stdio.h>
#include <termios.h>
int main(){
printf("Hello World!");
return 0;
}
并且在编译器处
$ which gcc
/usr/bin/gcc
$ gcc --version
gcc (GCC) 10.2.0
这个示例构建得很好
$ gcc -Wall prova.c -o prova
$ ./prova
Hello World!
发布于 2021-05-04 13:10:25
而不是这样:
#include <termios.h>
这一点:
#include <sys/termios.h>
https://stackoverflow.com/questions/67377303
复制相似问题