nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified
wrong reason
I want to compile colmap3.8 with VS, so use cmake
+ vcpkg
to configure the VS2022 project. When compiling colmap_cuda
, you need to use the nvcc compiler to compile the gpu code.
When compiling with NVCC, options appear in the command line /Zc:__cplusplus
, as shown in the figure below:
and it cannot be recognized by nvcc, so an error is reported:
nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified
Solution
Move /Zc:__cplusplus
the options into -Xcompiler=
the string that follows, as shown in the image below:
Further reading, about /Zc:__cplusplus
options
Compiling using MSVC as CUDA host compiler requires enabling __cplusplus (/Zc:__cplusplus). In order to do so, pass -Xcompiler “/Zc:__cplusplus” as an option to NVCC. Failing to do so may result in errors reporting that a variable of class dim3 can’t be declared constexpr.