Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

[BUG] <title>CMAKE #1

Open
nodaydddd opened this issue Mar 11, 2024 · 2 comments
Open

[BUG] <title>CMAKE #1

nodaydddd opened this issue Mar 11, 2024 · 2 comments

Comments

@nodaydddd
Copy link

/home/teamhd/sick_visionary_cpp_samples/sick_visionary_cpp_shared/src/TcpSocket.cpp: In member function ‘int visionary::TcpSocket::connect(const string&, uint16_t, uint32_t)’:
/home/teamhd/sick_visionary_cpp_samples/sick_visionary_cpp_shared/src/TcpSocket.cpp:72:24: error: conversion to ‘unsigned int’ from ‘int’ may change the sign of the result [-Werror=sign-conversion]
recvAddr.sin_port = htons(PPPP);
^~~~~
/home/teamhd/sick_visionary_cpp_samples/sick_visionary_cpp_shared/src/TcpSocket.cpp:36:65: error: unused parameter ‘port’ [-Werror=unused-parameter]
int TcpSocket::connect(const std::string& ipaddr, std::uint16_t port, std::uint32_t timeoutMs)
^~~~
cc1plus: all warnings being treated as errors

@nodaydddd
Copy link
Author

teamhd@teamhd:~/sick_visionary_cpp_samples$ cmake --build build
[ 3%] Building CXX object sick_visionary_cpp_shared/CMakeFiles/sick_visionary_cpp_shared.dir/src/UdpSocket.cpp.o
/home/teamhd/sick_visionary_cpp_samples/sick_visionary_cpp_shared/src/UdpSocket.cpp: In member function ‘int visionary::UdpSocket::connect(const string&, uint16_t)’:
/home/teamhd/sick_visionary_cpp_samples/sick_visionary_cpp_shared/src/UdpSocket.cpp:88:43: error: conversion to ‘unsigned int’ from ‘int’ may change the sign of the result [-Werror=sign-conversion]
m_pSockAddrIn->sockaddr_in.sin_port = htons(port);
^~~~~
cc1plus: all warnings being treated as errors
sick_visionary_cpp_shared/CMakeFiles/sick_visionary_cpp_shared.dir/build.make:75: recipe for target 'sick_visionary_cpp_shared/CMakeFiles/sick_visionary_cpp_shared.dir/src/UdpSocket.cpp.o' failed
I try to add “recvAddr.sin_port = htons(static_cast(port));” but it had no effect

@xfealal
Copy link
Collaborator

xfealal commented Apr 11, 2024

Hello @nodaydddd,
can you tell us what gcc version you are using?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants