Nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified

Hello everyone, I recently need to do a project to implement CUDA on Qt. I want to implement a simple CUDA program on Qt first. Therefore, I found a highly reliable engineering code in the online code case, and I hope to reproduce it on my computer. But in the process of compiling, the error of nvcc fatal: A single input file is required for a non-link phase when an outputfile is specified appeared. I tried some of the solutions mentioned on the Internet, but still no solution. In order to save everyone’s time, I only show the content of my .pro file and the information obtained from the compilation output here. Thank you very much for your help, thank you.
`CONFIG += console

TARGET = Qt-CUDA-example

Define output directories

DESTDIR = …/bin

This makes the .cu files appear in your project





MSVCRT link option (static or dynamic, it must be the same with your Qt SDK link option)


CUDA settings

CUDA_DIR = $$(CUDA_PATH) # Path to cuda toolkit install
SYSTEM_NAME = Win64#x86 # Depending on your system either ‘Win32’, ‘x64’, or ‘Win64’
SYSTEM_TYPE = 64 # ‘32’ or ‘64’, depending on your system
CUDA_ARCH = compute_50 #sm_50 # Type of CUDA architecture
NVCC_OPTIONS = --use_fast_math

include paths


library directories


The following makes sure all path names (which often include spaces) are put between quotation marks

CUDA_INC = $$join(INCLUDEPATH,’" -I"’,’-I"’,’"’)

Add the necessary libraries

CUDA_LIB_NAMES = cudart_static kernel32 user32 gdi32 winspool comdlg32
advapi32 shell32 ole32 oleaut32 uuid odbc32 odbccp32
#freeglut glew32

for(lib, CUDA_LIB_NAMES) {
CUDA_LIBS += -l$$lib
LIBS += -L"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib\x64"

Configuration of the Cuda compiler

CONFIG(debug, debug|release) {
# Debug mode
cuda_d.input = CUDA_SOURCES
cuda_d.output = $$CUDA_OBJECTS_DIR/${QMAKE_FILE_BASE}_cuda.obj
cuda_d.commands = $$CUDA_DIR/bin/nvcc.exe -D_DEBUG$$NVCC_OPTIONS$$CUDA_INC$$LIBS
–machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH
–compile -cudart static -g -DWIN32-D_MBCS
-Xcompiler “/wd4819,/EHsc,/W3,/nologo,/Od,/Zi,/RTC1”
cuda_d.dependency_type = TYPE_C
else {
# Release mode
cuda.input = CUDA_SOURCES
cuda.output = $$CUDA_OBJECTS_DIR/${QMAKE_FILE_BASE}_cuda.obj
cuda.commands = $$CUDA_DIR/bin/nvcc.exe $$NVCC_OPTIONS $$CUDA_INC $$LIBS
–machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH
–compile -cudart static -DWIN32 -D_MBCS
-Xcompiler “/wd4819,/EHsc,/W3,/nologo,/O2,/Zi”
cuda.dependency_type = TYPE_C

10:59:59: Perform steps for the project Qt-CUDA-example…

10:59:59: turning on “C:\Qt\Qt5.7.0\5.7\msvc2015_64\bin\qmake.exe” C:\Users\dell\Desktop\Qt-CUDA-example-master\Qt-CUDA-example.pro -r -spec win32-msvc2015 “CONFIG+=debug” “CONFIG+=qml_debug”

10:59:59: The process “C:\Qt\Qt5.7.0\5.7\msvc2015_64\bin\qmake.exe” exits normally.

10:59:59: turning on “C:\Qt\Qt5.7.0\Tools\QtCreator\bin\jom.exe”

C:\Qt\Qt5.7.0\Tools\QtCreator\bin\jom.exe -f Makefile.Debug

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2/bin/nvcc.exe -D_DEBUG–use_fast_math-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2/include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2/common/inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2/…/shared/inc"-lcudart_static -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -LC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib\x64 --machine 64 -arch=compute_50 --compile -cudart static -g -DWIN32-D_MBCS -Xcompiler /wd4819,/EHsc,/W3,/nologo,/Od,/Zi,/RTC1 -Xcompiler /MDd -c -o cuda\vectorAdd_cuda.obj…\Qt-CUDA-example-master\vectorAdd.cu

nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified

jom: C:\Users\dell\Desktop\build-Qt-CUDA-example-Desktop_Qt_5_7_1_MSVC2015_64bit-Debug\Makefile.Debug [cuda\vectorAdd_cuda.obj] Error 1

cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -Zi -MDd -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\Qt-CUDA-example.vc.pdb -DUNICODE -DWIN32 -DWIN64 -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I…\Qt-CUDA-example-master -I. -I"…\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2/common/inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2/…/shared/inc" -I…\Qt\Qt5.7.0\5.7\msvc2015_64\include -I…\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtGui -I…\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtANGLE -I…\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtCore -Idebug -I…\Qt\Qt5.7.0\5.7\msvc2015_64\mkspecs\win32-msvc2015 -Fodebug\ @C:\Users\dell\AppData\Local\Temp\main.obj.17896.15.jom


jom: C:\Users\dell\Desktop\build-Qt-CUDA-example-Desktop_Qt_5_7_1_MSVC2015_64bit-Debug\Makefile [debug] Error 2

11:00:00: The process “C:\Qt\Qt5.7.0\Tools\QtCreator\bin\jom.exe” exits with exit code 2.
Error while building/deploying project Qt-CUDA-example (kit: Desktop Qt 5.7.1 MSVC2015_64bit)

When executing step “Make”

11:00:00: Elapsed time: 00:01.

This is an error message that most commonly results from a malformed compiler command line. In particular, the compiler driver nvcc interprets anything that it does not recognize as a valid compiler switch as a source file name.

In this case, at a very quick glance, “-D_DEBUG–use_fast_math-” looks suspect. There seems to be missing white space.