#-------------------------------------------------
#
# Project created by QtCreator 2013-04-17T16:30:33
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = untitled6
TEMPLATE = app
SOURCES += main.cpp
# This makes the .cu files appear in your project
OTHER_FILES += ./vectorAddition.cu
# CUDA settings <-- may change depending on your system
CUDA_SOURCES += ./vectorAddition.cu
CUDA_SDK = "C:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.0" # Path to cuda SDK install
CUDA_DIR = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0" # Path to cuda toolkit install
# DO NOT EDIT BEYOND THIS UNLESS YOU KNOW WHAT YOU ARE DOING....
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
# include paths
INCLUDEPATH += $$CUDA_DIR/include \
$$CUDA_DIR/lib \
$$CUDA_SDK/shared/lib/Win32
# library directories
QMAKE_LIBDIR += $$QT_INSTALL_PREFIX/../Tools/MinGW-gcc440_1/mingw/lib \
$$CUDA_DIR/common/lib
CUDA_OBJECTS_DIR = ./
# Add the necessary libraries
CUDA_LIBS = -lcuda -lcudart
# The following makes sure all path names (which often include spaces) are put between quotation marks
CUDA_INC = $$join(INCLUDEPATH,'" -I"','-I"','"')
#LIBS += $$join(CUDA_LIBS,'.so ', '', '.so')
LIBS += $$CUDA_LIBS \
# 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.o
cuda_d.commands = $$CUDA_DIR/bin/nvcc.exe -D_DEBUG $$NVCC_OPTIONS $$CUDA_INC $$LIBS --machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
cuda_d.dependency_type = TYPE_C
QMAKE_EXTRA_COMPILERS += cuda_d
}
else {
# Release mode
cuda.input = CUDA_SOURCES
cuda.output = $$CUDA_OBJECTS_DIR/${QMAKE_FILE_BASE}_cuda.o
cuda.commands = $$CUDA_DIR/bin/nvcc.exe $$NVCC_OPTIONS $$CUDA_INC $$LIBS --machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
cuda.dependency_type = TYPE_C
QMAKE_EXTRA_COMPILERS += cuda
}
This is .pro file of QT. This code came from this page Compiling Cuda code in Qt Creator on Windows and this code is appropriately modified for my code.
Evenif I use this code, I have some errors.
14:52:46: Running steps for project untitled6...
14:52:46: Configuration unchanged, skipping qmake step.
14:52:46: Starting: "C:\Qt\Tools\MinGW-gcc440_1\mingw\bin\mingw32-make.exe"
C:/Qt/Tools/MinGW-gcc440_1/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Users/HTLAB/Documents/build-untitled6-Unnamed-Debug'
g++ -mthreads -Wl,-subsystem,windows -o debug\untitled6.exe vectorAddition_cuda.o debug/main.o -L"\..\Tools\MinGW-gcc440_1\mingw\lib" -L"c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\common\lib" -L"c:\Qt\4.8.1\lib" -lmingw32 -lqtmaind -lcuda -lcudart -lQtCored4
Warning: .drectve `/FAILIFMISMATCH:"_MSC_VER=1800" /FAILIFMISMATCH:"_ITERATOR_DEBUG_LEVEL=2" /FAILIFMISMATCH:"RuntimeLibrary=MTd_StaticDebug" /DEFAULTLIB:"libcpmtd" /DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
vectorAddition_cuda.o:(.text$mn+0x2a): undefined reference to `_hypotf'
vectorAddition_cuda.o:(.text$mn+0x4a): undefined reference to `__security_cookie'
vectorAddition_cuda.o:(.text$mn+0x1ab): undefined reference to `@__security_check_cookie@4'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\untitled6.exe] Error 1
mingw32-make: *** [debug] Error 2
mingw32-make[1]: Leaving directory `C:/Users/HTLAB/Documents/build-untitled6-Unnamed-Debug'
14:52:46: The process "C:\Qt\Tools\MinGW-gcc440_1\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project untitled6 (kit: Unnamed)
When executing step "Make"
14:52:46: Elapsed time: 00:00.
What should I do?