Hello,
I have just tried adding the libtorch libraries to my current project, as I want to start including it.
Unfortunately I am getting a most confusing error:
====================[ Build | Stratego_CPP | Debug ]============================
"C:\Program Files\JetBrains\CLion 2018.3.3\bin\cmake\win\bin\cmake.exe" --build C:\Users\Michael\Documents\GitHub\Stratego_CPP\cmake-build-debug --target Stratego_CPP -- -j 2
[ 9%] Building CXX object CMakeFiles/Stratego_CPP.dir/utils.cpp.obj
[ 18%] Building CXX object CMakeFiles/Stratego_CPP.dir/GameState.cpp.obj
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\utility:68:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\array:38,
from C:\Users\Michael\Documents\GitHub\Stratego_CPP\GameDeclarations.h:8,
from C:\Users\Michael\Documents\GitHub\Stratego_CPP\utils.h:8,
from C:\Users\Michael\Documents\GitHub\Stratego_CPP\utils.cpp:5:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\c++config.h:220:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\c++config.h:412:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\utility:68:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\array:38,
from C:\Users\Michael\Documents\GitHub\Stratego_CPP\GameDeclarations.h:8,
from C:\Users\Michael\Documents\GitHub\Stratego_CPP\utils.h:8,
from C:\Users\Michael\Documents\GitHub\Stratego_CPP\utils.cpp:5:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\c++config.h:537:3: error: operator '&&' has no right operand
&& _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201505L \.........
I am using Windows 10 and MinGW as my toolchains with gcc 6.3 installed. I have read about a similar issue on this forum regarding this ABI and (to my understanding) only gcc >= 4.9 works, which I should fulfill though.
My CmakeLists reads as follows and generates without errors:
cmake_minimum_required(VERSION 3.13)
project(Stratego_CPP)
set(CMAKE_CXX_STANDARD 17)
include_directories(${CMAKE_SOURCE_DIR}/libtorch/include)
set(CMAKE_PREFIX_PATH C:/Users/Michael/Documents/GitHub/Stratego_CPP/libtorch)
find_package(Torch REQUIRED)
set(COMMON_SOURCES utils.cpp GameState.cpp Game.cpp Piece.cpp
Board.cpp GameDeclarations.cpp StrategoLogic.cpp Agent.cpp
RandomSelector.h MCTS.cpp MCTS.h)
set(TARGET_SOURCES main.cpp)
add_executable(Stratego_CPP ${COMMON_SOURCES} ${TARGET_SOURCES})
target_link_libraries(Stratego_CPP "${TORCH_LIBRARIES}")
Can somebody help pointing me in the direction of why I am getting this error and how I can fix it?
Best regards,
Michael