I had similar issues compiling torchvision. I was using a compiler that supported C++14 and the CMakeLists.txt file had the correct flags set. The issue was with a CUDA flag that was getting set automatically. More info available at the issue I opened here: Failing to compile torchvision C++ API from source (>C++14 compiler required, which is installed) · Issue #4175 · pytorch/vision · GitHub 99