Closed JohannesKauffmann closed 1 year ago
Some winsock2 functions needs at least _WIN32_WINNT=0x0600 defined. This was discovered when using MinGW-w64 to cross-compile:
[ 21%] Building CXX object src/CMakeFiles/EIPScannerS.dir/sockets/EndPoint.cpp.obj /EIPScanner/src/sockets/EndPoint.cpp: In constructor ‘eipScanner::sockets::EndPoint::EndPoint(std::string, int)’: /EIPScanner/src/sockets/EndPoint.cpp:38:9: error: ‘inet_pton’ was not declared in this scope; did you mean ‘inet_ntoa’? 38 | if (inet_pton(AF_INET, _host.c_str(), &_addr.sin_addr.s_addr) < 0) { | ^~~~~~~~~ | inet_ntoa gmake[2]: *** [src/CMakeFiles/EIPScannerS.dir/build.make:377: src/CMakeFiles/EIPScannerS.dir/sockets/EndPoint.cpp.obj] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:168: src/CMakeFiles/EIPScannerS.dir/all] Error 2 gmake: *** [Makefile:149: all] Error 2
Turns out this is not an issue with cross-compilation, but rather with older MinGW/GCC versions. Updated the commit (message), and also restructured the existing MSVC check.
Some winsock2 functions needs at least _WIN32_WINNT=0x0600 defined. This was discovered when using MinGW-w64 to cross-compile: