Slamtec / rplidar_sdk

Open source SDK for Slamtec RPLIDAR series products
BSD 2-Clause "Simplified" License
428 stars 262 forks source link

Ubuntu compile error #70

Closed kiranmclernon closed 2 years ago

kiranmclernon commented 2 years ago

src/arch/linux/net_socket.cpp:171:16: error: ordered comparison of pointer with integer zero (‘const char*’ and ‘int’) 171 | return ans <= 0 ? RESULT_OPERATION_FAIL : RESULT_OK;

u_result SocketAddress::setAddressFromString(const char address_string, SocketAddress::address_type_t type) { int ans = 0; int prevPort = getPort(); switch (type) { case ADDRESS_TYPE_INET: reinterpret_cast<sockaddr_storage >(_platform_data)->ss_family = AF_INET; ans = inet_pton(AF_INET, address_string, &reinterpret_cast<sockaddr_in *>(_platform_data)->sin_addr); break;

    case ADDRESS_TYPE_INET6:

        reinterpret_cast<sockaddr_storage *>(_platform_data)->ss_family = AF_INET6;
        ans = inet_pton(AF_INET6, 
                        address_string, 
                        &reinterpret_cast<sockaddr_in6  *>(_platform_data)->sin6_addr);
    break;

    default:
        return RESULT_INVALID_DATA;

}
setPort(prevPort);

return ans <= 0 ? RESULT_INVALID_DATA : RESULT_OK;

}

When compiling on ubuntu the above error occurs in compilation from the above function.

Aokiji996 commented 1 year ago

same issue. How to solve it?