gcc linux - 'CRTSCTS' 'ECHOCTL' 未声明 (termios.h)
gcc linux - 'CRTSCTS' 'ECHOCTL' undeclared (termios.h)
我正在尝试编译一个在 Linux 上使用串行通信的静态库,但失败并出现以下错误:
gcc -o out/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/bluegiga/uart.o -c -std=gnu99 -Wall -ggdb -fPIC -Os -Wall -fPIC -pthread -m64 -DNDEBUG -DWITH_POSIX -D__linux__ -DWIFI_ADAPTER -DETHERNET_ADAPTER -DNO_EDR_ADAPTER -DNO_LE_ADAPTER -DMULTI_THREAD -D_XOPEN_SOURCE=600 -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/api -Iservice/protocol-plugin/plugins/ble/lib/api -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Ideps/linux/include -Iextlibs/cereal/include -Iextlibs/cereal/cereal/include -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/inc -Iservice/protocol-plugin/plugins/ble/lib/inc -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/lib/libcoap-4.1.1 -Iservice/protocol-plugin/plugins/ble/lib/lib/libcoap-4.1.1 -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/common/inc -Iservice/protocol-plugin/plugins/ble/lib/common/inc -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/bluegiga/common/inc -Iservice/protocol-plugin/plugins/ble/lib/bluegiga/common/inc -Iresource -Iresource/include -Iresource/oc_logger/include -Iresource/csdk/stack/include -Iresource/csdk/ocrandom/include -Iresource/csdk/logger/include -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/bluegiga -Iservice/protocol-plugin/plugins/ble/lib/bluegiga service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c
service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c: In function 'uart_open':
service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c:287:52: error: 'CRTSCTS' undeclared (first use in this function)
options.c_cflag &= ~(PARENB | CSTOPB | CSIZE | CRTSCTS | HUPCL);
...
service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c:289:74: error: 'ECHOCTL' undeclared (first use in this function)
...
service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c:289:84: error: 'ECHOPRT' undeclared (first use in this function)
...
我已经搜索过这个问题,但我能找到的唯一信息是:
CRTSCTS not define when compiling as C99
不幸的是,解决方案(使用 -std=gnu99
)对我不起作用。
这里是一些环境信息:
$ gcc --version
$ gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
$ uname -r
$ 3.13.0-48-generic
问题出在 gcc 命令的 -D_XOPEN_SOURCE=600
部分。删除它后,所有编译都没有问题。
更详细的解释可以在我链接到的问题的答案中找到。
我正在尝试编译一个在 Linux 上使用串行通信的静态库,但失败并出现以下错误:
gcc -o out/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/bluegiga/uart.o -c -std=gnu99 -Wall -ggdb -fPIC -Os -Wall -fPIC -pthread -m64 -DNDEBUG -DWITH_POSIX -D__linux__ -DWIFI_ADAPTER -DETHERNET_ADAPTER -DNO_EDR_ADAPTER -DNO_LE_ADAPTER -DMULTI_THREAD -D_XOPEN_SOURCE=600 -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/api -Iservice/protocol-plugin/plugins/ble/lib/api -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Ideps/linux/include -Iextlibs/cereal/include -Iextlibs/cereal/cereal/include -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/inc -Iservice/protocol-plugin/plugins/ble/lib/inc -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/lib/libcoap-4.1.1 -Iservice/protocol-plugin/plugins/ble/lib/lib/libcoap-4.1.1 -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/common/inc -Iservice/protocol-plugin/plugins/ble/lib/common/inc -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/bluegiga/common/inc -Iservice/protocol-plugin/plugins/ble/lib/bluegiga/common/inc -Iresource -Iresource/include -Iresource/oc_logger/include -Iresource/csdk/stack/include -Iresource/csdk/ocrandom/include -Iresource/csdk/logger/include -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/bluegiga -Iservice/protocol-plugin/plugins/ble/lib/bluegiga service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c
service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c: In function 'uart_open':
service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c:287:52: error: 'CRTSCTS' undeclared (first use in this function)
options.c_cflag &= ~(PARENB | CSTOPB | CSIZE | CRTSCTS | HUPCL);
...
service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c:289:74: error: 'ECHOCTL' undeclared (first use in this function)
...
service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c:289:84: error: 'ECHOPRT' undeclared (first use in this function)
...
我已经搜索过这个问题,但我能找到的唯一信息是: CRTSCTS not define when compiling as C99
不幸的是,解决方案(使用 -std=gnu99
)对我不起作用。
这里是一些环境信息:
$ gcc --version
$ gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
$ uname -r
$ 3.13.0-48-generic
问题出在 gcc 命令的 -D_XOPEN_SOURCE=600
部分。删除它后,所有编译都没有问题。
更详细的解释可以在我链接到的问题的答案中找到。