'linker input file unused because linking not done' when trying to setup QT creator & Cuda


Staff member
I'm trying to get started with with C and Cuda using QT creator as the IDE. Unfortunately I'm having problems from the start and not sure where its coming from(if it started gradually it'd be easier to identify).

I basically already installed CUDA(and c) and had small test programs running but I wanted to use an IDE so I installed QT creator using the instructions on: <a href="http://cudaspace.wordpress.com/2011/04/07/qt-creator-cuda-linux/" rel="nofollow">http://cudaspace.wordpress.com/2011/04/07/qt-creator-cuda-linux/</a> but I'm getting errors when running the example: 'linker input file unused because linking not done'

Here's all the files(with my modifications since I'm using a mac and the instructions are for linux. I can compile basic
hello world
type things but not the example for some reason):

CONFIG += qt4

SOURCES += main.cpp \
# Cuda sources
CUDA_SOURCES += cuda_interface.cu
# Project dir and outputs
PROJECT_DIR = $$system(pwd)
DESTDIR = ../bin

# Path to cuda SDK install
CUDA_SDK = /Users/lostsoul/Dropbox/qt_cuda/C/
# Path to cuda toolkit install
CUDA_DIR = /usr/local/cuda
# GPU architecture
CUDA_ARCH = compute_10
# nvcc flags (ptxas option verbose is always useful)
NVCCFLAGS = --compiler-options -fno-strict-aliasing -use_fast_math --ptxas-options=-v
# include paths
INCLUDEPATH += $$CUDA_SDK/common/inc/
INCLUDEPATH += $$CUDA_SDK/../shared/inc/
# lib dirs
QMAKE_LIBDIR += $$CUDA_SDK/common/lib
# libs - note than i'm using a x_86_64 machine
LIBS += -lcudart -lcutil_x86_64
# join the includes in a line
CUDA_INC = $$join(INCLUDEPATH,' -I','-I',' ')
LD_LIBRARY_PATH = /usr/local/cuda/lib

# Prepare the extra compiler configuration (taken from the nvidia forum - i'm not an expert in this part)
cuda.input = CUDA_SOURCES
cuda.output = ${OBJECTS_DIR}${QMAKE_FILE_BASE}_cuda.o

cuda.commands = $$CUDA_DIR/bin/nvcc -m64 -g -G -arch=$$CUDA_ARCH -c $$NVCCFLAGS $$CUDA_INC $$LIBS  ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT}

cuda.dependcy_type = TYPE_C
cuda.depend_command = $$CUDA_DIR/bin/nvcc -g -G -M $$CUDA_INC $$NVCCFLAGS   ${QMAKE_FILE_NAME}
# Tell Qt that we want add more stuff to the Makefile


// CUDA-C includes
#include &lt;cuda.h&gt;
#include &lt;cutil_inline.h&gt;

extern "C"
void runCudaPart();

// Main cuda function

void runCudaPart() {

// all your cuda code here *smile*



#include &lt;QtCore/QCoreApplication&gt;

// This is the 'elder trick of the...' - Tell the compiler this function is defined in other place
extern "C"
void runCudaPart();

int main(int argc, char *argv[]) {

    QCoreApplication a(argc, argv);


    return a.exec();


Here's the output of the error:

09:24:27: Running build steps for project first_project...
09:24:27: Configuration unchanged, skipping qmake step.
09:24:27: Starting: "/usr/bin/make" -w
make: Entering directory `/Users/lostsoul/Dropbox/qt_cuda/first_project-build-desktop-Desktop_Qt_4_8_1_for_GCC__Qt_SDK__Debug'
/usr/local/cuda/bin/nvcc -m64 -g -G -arch=compute_10 -c --compiler-options -fno-strict-aliasing -use_fast_math --ptxas-options=-v -I/usr/local/cuda/include -I/Users/lostsoul/Dropbox/qt_cuda/C//common/inc/ -I/Users/lostsoul/Dropbox/qt_cuda/C//../shared/inc/ -lcudart -lcutil_x86_64 ../first_project/cuda_interface.cu -o ../first_project/Obj/cuda_interface_cuda.o
g++ -c -pipe -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/mkspecs/macx-g++ -I../first_project -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtCore.framework/Versions/4/Headers -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/include/QtCore -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Versions/4/Headers -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/include/QtGui -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/include -I/usr/local/cuda/include -I../C/common/inc -I/Users/lostsoul/Dropbox/qt_cuda/C//../shared/inc/ -I. -I../first_project -I. -F/Users/lostsoul/QtSDK/Desktop/Qt/4.8.1/gcc/lib -o ../first_project/Obj/main.o ../first_project/main.cpp
gcc -c -pipe -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/mkspecs/macx-g++ -I../first_project -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtCore.framework/Versions/4/Headers -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/include/QtCore -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Versions/4/Headers -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/include/QtGui -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/include -I/usr/local/cuda/include -I../C/common/inc -I/Users/lostsoul/Dropbox/qt_cuda/C//../shared/inc/ -I. -I../first_project -I. -F/Users/lostsoul/QtSDK/Desktop/Qt/4.8.1/gcc/lib -o ../first_project/Obj/cuda_interface.o ../first_project/cuda_interface.cu
i686-apple-darwin11-llvm-gcc-4.2: ../first_project/cuda_interface.cu: linker input file unused because linking not done
g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o ../bin/first_project.app/Contents/MacOS/first_project ../first_project/Obj/cuda_interface_cuda.o ../first_project/Obj/main.o ../first_project/Obj/cuda_interface.o   -F/Users/lostsoul/QtSDK/Desktop/Qt/4.8.1/gcc/lib -L/usr/local/cuda/lib64 -L/Users/lostsoul/Dropbox/qt_cuda/C//lib -L/Users/lostsoul/Dropbox/qt_cuda/C//common/lib -L/Users/lostsoul/QtSDK/Desktop/Qt/4.8.1/gcc/lib -lcudart -lcutil_x86_64 -framework QtGui -L/usr/local/pgsql/lib -L/tmp/qt-stuff-85167/source/qt-everywhere-opensource-src-4.8.1/Desktop/Qt/4.8.1/gcc/lib -F/tmp/qt-stuff-85167/source/qt-everywhere-opensource-src-4.8.1/Desktop/Qt/4.8.1/gcc/lib -framework QtCore 
i686-apple-darwin11-llvm-g++-4.2: ../first_project/Obj/cuda_interface.o: No such file or directory
make: *** [../bin/first_project.app/Contents/MacOS/first_project] Error 1
make: Leaving directory `/Users/lostsoul/Dropbox/qt_cuda/first_project-build-desktop-Desktop_Qt_4_8_1_for_GCC__Qt_SDK__Debug'
09:24:33: The process "/usr/bin/make" exited with code 2.
Error while building project first_project (target: Desktop)
When executing build step 'Make'

I've been struggling to figure this out for the last few hours and I'm really unsure how to approach this. The only thing I thought was maybe my version of make was too new for the instructions(since the tutorial I followed was from last year) but commands seemed to execute. I'm really really new to C/Cuda and QT creator and my only goal is to execute c/c++ &amp; cuda code on QT(because apparently it can compile both in a way they talk to each other and does code completion). The more I dig deep the more unsure I am if this error is a QT error or a C error(I don't think its a CUDA specific error since I really don't have any code there).

please help!