TencentCloud / tencentcloud-iot-sdk-embedded-c

SDK for connecting to Tencent Cloud IoT from a device using embedded C.
https://cloud.tencent.com/product/iothub
Other
149 stars 71 forks source link

linux ubuntu18.04编译不过 #42

Closed goog closed 1 year ago

goog commented 1 year ago
[ 55%] Building C object sdk_src/CMakeFiles/iot_sdk.dir/network/socket/network_socket.c.o
[ 56%] Building C object sdk_src/CMakeFiles/iot_sdk.dir/network/network_interface.c.o
[ 57%] Linking C static library ../../output/release/lib/libiot_sdk.a
[ 57%] Built target iot_sdk
Scanning dependencies of target iot_platform
[ 59%] Building C object platform/CMakeFiles/iot_platform.dir/os/linux/HAL_Device_linux.c.o
[ 60%] Building C object platform/CMakeFiles/iot_platform.dir/os/linux/HAL_File_linux.c.o
[ 61%] Building C object platform/CMakeFiles/iot_platform.dir/os/linux/HAL_Log_linux.c.o
[ 62%] Building C object platform/CMakeFiles/iot_platform.dir/os/linux/HAL_OS_linux.c.o
[ 63%] Building C object platform/CMakeFiles/iot_platform.dir/os/linux/HAL_TCP_linux.c.o
[ 64%] Building C object platform/CMakeFiles/iot_platform.dir/os/linux/HAL_Timer_linux.c.o
In file included from /home/xie/mywork/cj/tencentcloud-iot-explorer-sdk-embedded-c-3.2.2/platform/os/linux/HAL_Timer_linux.c:26:0:
/home/xie/mywork/cj/tencentcloud-iot-explorer-sdk-embedded-c-3.2.2/platform/os/linux/HAL_Timer_linux.c: In function 'HAL_Timer_expired':
/home/xie/mywork/cj/tencentcloud-iot-explorer-sdk-embedded-c-3.2.2/platform/os/linux/HAL_Timer_linux.c:35:5: error: request for member 'tv_sec' in something not a structure or union
     timersub(&timer->end_time, &now, &res);
     ^
/home/xie/mywork/cj/tencentcloud-iot-explorer-sdk-embedded-c-3.2.2/platform/os/linux/HAL_Timer_linux.c:35:5: error: request for member 'tv_usec' in something not a structure or union
     timersub(&timer->end_time, &now, &res);
     ^
/home/xie/mywork/cj/tencentcloud-iot-explorer-sdk-embedded-c-3.2.2/platform/os/linux/HAL_Timer_linux.c: In function 'HAL_Timer_countdown_ms':
/home/xie/mywork/cj/tencentcloud-iot-explorer-sdk-embedded-c-3.2.2/platform/os/linux/HAL_Timer_linux.c:44:5: error: request for member 'tv_sec' in something not a structure or union
     timeradd(&now, &interval, &timer->end_time);
     ^
/home/xie/mywork/cj/tencentcloud-iot-explorer-sdk-embedded-c-3.2.2/platform/os/linux/HAL_Timer_linux.c:44:5: error: request for member 'tv_usec' in something not a structure or union
     timeradd(&now, &interval, &timer->end_time);
     ^
/home/xie/mywork/cj/tencentcloud-iot-explorer-sdk-embedded-c-3.2.2/platform/os/linux/HAL_Timer_linux.c:44:5: error: request for member 'tv_usec' in something not a structure or union
     timeradd(&now, &interval, &timer->end_time);
     ^
/home/xie/mywork/cj/tencentcloud-iot-explorer-sdk-embedded-c-3.2.2/platform/os/linux/HAL_Timer_linux.c:44:5: error: request for member 'tv_sec' in something not a structure or union
     timeradd(&now, &interval, &timer->end_time);
goog commented 1 year ago
struct Timer {
#if defined(__linux__) && defined(__GLIBC__)
    struct timeval end_time;
#else

solved by change here to #if defined(__linux__)