我的机器有 CRTSCTS
#定义在一个 #ifdef __USE_MISC
这使得我编译的C程序无法使用它。
usrincludex86_64-linux-gnubitstermios.h。
...
#define B4000000 0010017
#define __MAX_BAUD B4000000
#ifdef __USE_MISC
# define CIBAUD 002003600000 /* input baud rate (not used) */
# define CMSPAR 010000000000 /* mark or space (stick) parity */
# define CRTSCTS 020000000000 /* flow control */
#endif
/* c_lflag bits */
#define ISIG 0000001
#define ICANON 0000002
...
我怎样才能在不黑掉CRTSCTS的值的情况下访问它呢?020000000000
纳入我的程序?
我已经 #include <termios.h>
和许多其他头文件。
我也在使用。
#define __USE_POSIX199309
#define _POSIX_C_SOURCE 199309L
#include <time.h> /* nanosleep needs lines above */
这个 __USE_MISC
宏是一个内部定义,虽然我想你可以自己定义,但最好是找到合适的功能测试宏来实现它。
在我的CentOS 7系统上。/usr/include/features.h
有一系列这类宏,看来 __USE_MISC
通过以下方式启用 _BSD_SOURCE
或 _SVID_SOURCE
;不清楚哪一个与你需要的其他东西兼容。
... // features.h
#if defined _BSD_SOURCE || defined _SVID_SOURCE
# define __USE_MISC 1
#endif
试试 #define _BSD_SOURCE
在你的程序的顶部--在所有的包含之前--看看它是如何进行的。
参考文献 http:/man7.orglinuxman-pagesman7feature_test_macros.7.html)。