I am trying to run the DCGAN tutorial for C++ frontend:
But when I run the command:
cmake --build . --config Release
There are many errors:
First error states that I am using an old GCC version and I have to use at least GCC 5 (I am using 9).
Second error says that I need C++14 to compile PyTorch. However in CMake in tutorial we add a line:
set_property(TARGET dcgan PROPERTY CXX_STANDARD 11)
Any help, pointers, directions is still appreciated…
You can change the cmake file to
set_property(TARGET dcgan PROPERTY CXX_STANDARD 14). It’s impossible to tell what the problem is without seeing the code and the error logs. I am using GCC9 as well. Looking at my code it differs from the tutorial a little bit but perhaps you can look at it here and figure out your problem.
Thank you. I had changed it to 14 but I neglected to recreate the Makefile through cmake -DCMAKE_PREFIX_PATH=/path/to/libtorch … before rebuilding the project. That solved the problem.
And thanks whomever updated the tutorial.
Just a quick update. The error on my side was also related to the cc version on my machine. It seems that CMake looks at cc when creating the Makefile not gcc. While my gcc was version 9.x my cc was 4.x which lead to the compiler version error.
This could be solved by adding an environment variable for cc (if newer versions already exist):