【发布时间】:2020-05-22 14:11:49
【问题描述】:
我的机器在#ifdef __USE_MISC 中有CRTSCTS #defined,这会阻止我编译的C 程序使用它。
/usr/include/x86_64-linux-gnu/bits/termios.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
...
如何在不将值 020000000000 侵入我的程序的情况下访问 CRTSCTS?
我已经#include <termios.h> 和许多其他标题。
我也在用:
#define __USE_POSIX199309
#define _POSIX_C_SOURCE 199309L
#include <time.h> /* nanosleep needs lines above */
【问题讨论】:
-
#define __USE_POSIX199309来自man feature_test_macros:These macros have names prefixed by two underscores (e.g., __USE_MISC). Programs should never define these macros directly -
KamilCuk 是对的 - 你想用
__USE_POSIX199309完成什么? -
使用 __USE_POSIX199309 和类似的将没有效果。它们在“features.h”中未定义,然后构建。该过程会尝试确定您的平台并选择合适的定义。
标签: c ubuntu-18.04 termios flow-control