S3ler / linux-mqtt-sn-gateway

Linux based MQTT-SN Gateway
13 stars 6 forks source link

mqtt-sn-gateway with LinuxTelnetSocket #1

Closed bngesp closed 5 years ago

bngesp commented 5 years ago

After cloning with git i use this command cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DTRANSMISSION_PROTOCOL=TELNET

then I have the following output error when i try to do make linux-mqtt-sn-gateway.

[ 41%] Built target PahoLinuxMqttMessageHandler
[ 64%] Built target core-mqtt-sn-gateway
[ 74%] Built target arduino-linux-abstraction
[ 77%] Building CXX object CMakeFiles/lib-linux-mqtt-sn-gateway.dir/src/Implementation/Telnet/LinuxTelnetSocket.cpp.o
In file included from /Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/Implementation/Telnet/LinuxTelnetSocket.cpp:5:
In file included from /Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/Implementation/Telnet/LinuxTelnetSocket.h:9:
In file included from /Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/SocketInterface.h:10:
In file included from /Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/MqttSnMessageHandler.h:10:
In file included from /Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/CoreInterface.h:6:
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/mqttsn_messages.h:172:32: warning: 'memset' call operates on objects of
      type 'msg_willtopic' while the size is based on a different type 'msg_willtopic *' [-Wsizeof-pointer-memaccess]
        memset(this, 0, sizeof(this));
               ~~~~            ^~~~
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/mqttsn_messages.h:172:32: note: did you mean to dereference the argument to
      'sizeof' (and multiply it by the number of elements)?
        memset(this, 0, sizeof(this));
                               ^~~~
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/mqttsn_messages.h:192:32: warning: 'memset' call operates on objects of
      type 'msg_willmsg' while the size is based on a different type 'msg_willmsg *' [-Wsizeof-pointer-memaccess]
        memset(this, 0, sizeof(this));
               ~~~~            ^~~~
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/mqttsn_messages.h:192:32: note: did you mean to dereference the argument to
      'sizeof' (and multiply it by the number of elements)?
        memset(this, 0, sizeof(this));
                               ^~~~
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/mqttsn_messages.h:249:32: warning: 'memset' call operates on objects of
      type 'msg_publish' while the size is based on a different type 'msg_publish *' [-Wsizeof-pointer-memaccess]
        memset(this, 0, sizeof(this));
               ~~~~            ^~~~
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/mqttsn_messages.h:249:32: note: did you mean to dereference the argument to
      'sizeof' (and multiply it by the number of elements)?
        memset(this, 0, sizeof(this));
                               ^~~~
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/mqttsn_messages.h:320:32: warning: 'memset' call operates on objects of
      type 'msg_subscribe_shorttopic' while the size is based on a different type 'msg_subscribe_shorttopic *' [-Wsizeof-pointer-memaccess]
        memset(this, 0, sizeof(this));
               ~~~~            ^~~~
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/mqttsn_messages.h:320:32: note: did you mean to dereference the argument to
      'sizeof' (and multiply it by the number of elements)?
        memset(this, 0, sizeof(this));
                               ^~~~
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/mqttsn_messages.h:355:32: warning: 'memset' call operates on objects of
      type 'msg_subscribe_topicname' while the size is based on a different type 'msg_subscribe_topicname *' [-Wsizeof-pointer-memaccess]
        memset(this, 0, sizeof(this));
               ~~~~            ^~~~
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/core-mqtt-sn-gateway/src/mqttsn_messages.h:355:32: note: did you mean to dereference the argument to
      'sizeof' (and multiply it by the number of elements)?
        memset(this, 0, sizeof(this));
                               ^~~~
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/Implementation/Telnet/LinuxTelnetSocket.cpp:103:1: warning: control may reach end of non-void
      function [-Wreturn-type]
}
^
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/Implementation/Telnet/LinuxTelnetSocket.cpp:109:9: warning: logical not is only applied to the left
      hand side of this comparison [-Wlogical-not-parentheses]
    if (!(sock = socket(AF_INET, SOCK_STREAM, 0)) > 0) {
        ^                                         ~
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/Implementation/Telnet/LinuxTelnetSocket.cpp:109:9: note: add parentheses after the '!' to evaluate
      the comparison first
    if (!(sock = socket(AF_INET, SOCK_STREAM, 0)) > 0) {
        ^
         (                                           )
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/Implementation/Telnet/LinuxTelnetSocket.cpp:109:9: note: add parentheses around left hand side
      expression to silence this warning
    if (!(sock = socket(AF_INET, SOCK_STREAM, 0)) > 0) {
        ^
        (                                        )
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/Implementation/Telnet/LinuxTelnetSocket.cpp:593:21: error: implicit instantiation of undefined
      template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
        std::string s = std::to_string(address->bytes[i]);
                    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:193:33: note: template is declared here
    class _LIBCPP_TYPE_VIS_ONLY basic_string;
                                ^
/Users/bng/mqttsn/testGateway/linux-mqtt-sn-gateway/src/Implementation/Telnet/LinuxTelnetSocket.cpp:610:21: error: implicit instantiation of undefined
      template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
        std::string s = std::to_string(buf[i]);
                    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:193:33: note: template is declared here
    class _LIBCPP_TYPE_VIS_ONLY basic_string;
                                ^
7 warnings and 2 errors generated.
make[3]: *** [CMakeFiles/lib-linux-mqtt-sn-gateway.dir/src/Implementation/Telnet/LinuxTelnetSocket.cpp.o] Error 1
make[2]: *** [CMakeFiles/lib-linux-mqtt-sn-gateway.dir/all] Error 2
make[1]: *** [CMakeFiles/linux-mqtt-sn-gateway.dir/rule] Error 2
make: *** [linux-mqtt-sn-gateway] Error 2
bngesp commented 5 years ago

Resolved !!

I just have to modify the LinuxTelnetSocket.h file and change <string.h> to <string>