我正在尝试编译一个在Linux上使用串行通信的静态库,但它失败并出现以下错误:
*$sans_prefix
我已经四处寻找这个问题了,我能找到的唯一信息就在这里: CRTSCTS not define when compiling as C99
不幸的是,解决方案(使用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)
...
)对我没用。
以下是一些环境信息:
-std=gnu99
答案 0 :(得分:1)
问题是gcc命令的-D_XOPEN_SOURCE=600
部分。删除后,所有编译都没有问题。
更详细的解释可以在我链接到的问题的答案中找到。