zlgopen / awtk-android

awtk-android port
6 stars 4 forks source link

编译demoui时关于serial_helper.c中#include "tkc/socket_helper.h"头文件包含的错误 #6

Open meilizhongguo2 opened 8 months ago

meilizhongguo2 commented 8 months ago

开发环境的具体配置: windows系统版本:win11 android-studio-2023.1.1.28-windows jdk-17_windows-x64_bin android sdk的版本:android 14.0 API34 android ndk的版本:26.2.11394342

编译报错:

-MF CMakeFiles\awtk.dir\awtk\src\tkc\serial_helper.c.o.d -o CMakeFiles/awtk.dir/awtk/src/tkc/serial_helper.c.o -c D:/awtk-android/awtk-android/build/demoui/app/src/main/cpp/awtk/src/tkc/serial_helper.c
D:/awtk-android/awtk-android/build/demoui/app/src/main/cpp/awtk/src/tkc/serial_helper.c:1004:10: error: call to undeclared function 'tk_socket_wait_for_data'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  return tk_socket_wait_for_data(fd, timeout_ms);
         ^
1 error generated.

demoui/app/src/main/cpp/awtk/src/tkc/serial_helper.c第1004行: return tk_socket_wait_for_data(fd, timeout_ms);//该函数未声明导致报错 解决:

serial_helper.c的第40行:
#ifdef TK_IS_PC
#include "tkc/socket_pair.h"
#include "tkc/socket_helper.h"//将该行拿到宏外面去就可以解决问题,这里不明白的是TK_IS_PC宏未定义的情况下为什么引用了该头文件种的函数
#endif/*TK_IS_PC*/
xianjimli commented 8 months ago

你更新AWTK再试试,谢谢。