MinGW build issues caused by boost/asio includes
I try to build the library with MinGW compiler and have a number of compile errors that I needed to fix to get further in the build process:
Issue 1
[ 63%] Building CXX object RobWorkHardware/src/rwhw/universalrobots/CMakeFiles/sdurwhw_universalrobots.dir/UniversalRobotsRTLogging.cpp.obj
In file included from C:/CodingXP/mingw730_32/usr/include/boost/asio/detail/win_tss_ptr.hpp:23:0,
from C:/CodingXP/mingw730_32/usr/include/boost/asio/detail/tss_ptr.hpp:25,
from C:/CodingXP/mingw730_32/usr/include/boost/asio/detail/call_stack.hpp:20,
from C:/CodingXP/mingw730_32/usr/include/boost/asio/detail/thread_context.hpp:20,
from C:/CodingXP/mingw730_32/usr/include/boost/asio/detail/recycling_allocator.hpp:20,
from C:/CodingXP/mingw730_32/usr/include/boost/asio/detail/handler_alloc_helpers.hpp:21,
from C:/CodingXP/mingw730_32/usr/include/boost/asio/detail/executor_op.hpp:20,
from C:/CodingXP/mingw730_32/usr/include/boost/asio/impl/system_executor.hpp:18,
from C:/CodingXP/mingw730_32/usr/include/boost/asio/system_executor.hpp:129,
from C:/CodingXP/mingw730_32/usr/include/boost/asio/associated_executor.hpp:21,
from C:/CodingXP/mingw730_32/usr/include/boost/asio.hpp:21,
from C:\CodingXP\RobWork\RobWorkHardware\src\rwhw\universalrobots\UniversalRobotsRTLogging.hpp:25,
from C:\CodingXP\RobWork\RobWorkHardware\src\rwhw\universalrobots\UniversalRobotsRTLogging.cpp:18:
C:/CodingXP/mingw730_32/usr/include/boost/asio/detail/socket_types.hpp:24:4: error: #error WinSock.h has already been included
# error WinSock.h has already been included
Solution
The solution from here works for me - that means changing the order of includes to ensure that boost/asio is included before windows.h. I needed to do this for a number of source files that include boost/asio:
- DockWelder.cpp
- URPrimaryInterface.hpp
- UniversalRobotsRTLogging.hpp
- URRTDE.cpp