I resolved the issue by reading another article http://robot9.me/cuda_qtcreator_windows/
As discussed, Mismatch Discovered for "RuntimeLibrary" . The MSVCRT reference parameter must remain consistent. Thus, the /MDd added before the NVCC configuration.
But the key is to install cuda.commands . In contrast to the question: Compiling Cuda code in Qt Creator on Windows (I tried this configuration, but did not work for me) my nvcc is installed as follows:
# MSVCRT link option (static or dynamic, it must be the same with your Qt SDK link option) MSVCRT_LINK_FLAG_DEBUG = "/MDd" MSVCRT_LINK_FLAG_RELEASE = "/MD" CONFIG(debug, debug|release) { #Debug settings # 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" \ -Xcompiler $$MSVCRT_LINK_FLAG_DEBUG \ -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME} cuda_d.dependency_type = TYPE_C QMAKE_EXTRA_COMPILERS += cuda_d } else { # Release settings 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" \ -Xcompiler $$MSVCRT_LINK_FLAG_RELEASE \ -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME} cuda.dependency_type = TYPE_C QMAKE_EXTRA_COMPILERS += cuda }
Despite the fact that I still do not quite understand some of cuda.commands, but it really works. For more information on NVCC configuration, see http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#axzz3FOBrgXpc .
Here is the full version of my .pro file
#------------------------------------------------- # # Project created by QtCreator 2013-09-01T16:29:35 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = FFTW //your project name TEMPLATE = app HEADERS += dialog.h \ include/fftw3.h \ //header i need for my project SOURCES += main.cpp\ dialog.cpp INCLUDEPATH += $$PWD/ DEPENDPATH += $$PWD/ DESTDIR = debug OBJECTS_DIR = debug/obj # directory where .obj files will be saved CUDA_OBJECTS_DIR = debug/obj # directory where .obj of cuda file will be saved # This makes the .cu files appear in your project OTHER_FILES += intmapping.cu # this is my cu file need to compile # CUDA settings <-- may change depending on your system CUDA_SOURCES += intmapping.cu # let NVCC know which file you want to compile CUDA NVCC CUDA_SDK = "C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C" # Path to cuda SDK install CUDA_DIR = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v6.5" SYSTEM_NAME = Win32 # Depending on your system either 'Win32', 'x64', or 'Win64' SYSTEM_TYPE = 32 # '32' or '64', depending on your system CUDA_ARCH = sm_20 # Type of CUDA architecture, for example 'compute_10', 'compute_11', 'sm_10' NVCC_OPTIONS += --use_fast_math # default setting # include paths INCLUDEPATH += $$CUDA_DIR/include\ $$CUDA_SDK/common/inc\ $$CUDA_SDK/../shared/inc\ # library directories QMAKE_LIBDIR += $$join(CUDA_DIR,'" -I"','-I"','"')/lib/$$SYSTEM_NAME\ $$join(CUDA_SDK,'" -I"','-I"','"')/common/lib/$$SYSTEM_NAME\ $$join(CUDA_SDK,'" -I"','-I"','"')/../shared/lib/$$SYSTEM_NAME # Add the necessary libraries CUDA_LIBS= -lcuda -lcudart -lcufft #add quotation for those directories contain space (Windows required) CUDA_INC +=$$join(INCLUDEPATH,'" -I"','-I"','"') LIBS += $$CUDA_LIBS #nvcc config # MSVCRT link option (static or dynamic, it must be the same with your Qt SDK link option) MSVCRT_LINK_FLAG_DEBUG = "/MDd" MSVCRT_LINK_FLAG_RELEASE = "/MD" CONFIG(debug, debug|release) { #Debug settings # 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" \ -Xcompiler $$MSVCRT_LINK_FLAG_DEBUG \ -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME} cuda_d.dependency_type = TYPE_C QMAKE_EXTRA_COMPILERS += cuda_d } else { # Release settings 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" \ -Xcompiler $$MSVCRT_LINK_FLAG_RELEASE \ -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME} cuda.dependency_type = TYPE_C QMAKE_EXTRA_COMPILERS += cuda } FORMS += \ dialog.ui win32: LIBS += -L$$PWD/lib/ -llibfftw3f-3 #library i need in my project INCLUDEPATH += $$PWD/lib DEPENDPATH += $$PWD/lib