作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试编译一个在 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
部分。删除它后,一切编译都没有问题。
可以在我链接到的问题的答案中找到更详细的解释。
关于c - gcc linux - 'CRTSCTS' 'ECHOCTL' 未声明 (termios.h),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30034850/
我正在尝试编译一个在 Linux 上使用串行通信的静态库,但失败并出现以下错误: gcc -o out/linux/x86_64/release/service/protocol-plugin/plu
我是一名优秀的程序员,十分优秀!