Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Linker issue with YOLO CUDA 8.0 API libraries in c files
Forum Updated to NodeBB v4.3 + New Features

Linker issue with YOLO CUDA 8.0 API libraries in c files

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 3.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    slman_alii
    wrote on last edited by
    #1

    Re: Linker issue with CUDA API libraries

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to the forums

      Does link come with question ?

      if using C++, you might need to wrap the includes in
      extern "C" {
      #include "xxx.h"
      }

      But else you must tell a bit more about what issue is , what you tried, the
      error messages you get etc. The compiler you use.

      else the link shows how to link to the libs.

      1 Reply Last reply
      1
      • S Offline
        S Offline
        slman_alii
        wrote on last edited by
        #3

        the problem is with functions that defined in cu file and used in c file.
        sorry my question isn't clear enough

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Then please show the exact error you are getting.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • S Offline
            S Offline
            slman_alii
            wrote on last edited by
            #5

            0_1528320488198_Capture1.JPG

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              What does your .pro file look like ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              2
              • S Offline
                S Offline
                slman_alii
                wrote on last edited by
                #7

                QT += core gui

                greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                DEFINES += OPENCV
                DEFINES +=_TIMESPEC_DEFINED
                DEFINES +=_CRT_SECURE_NO_WARNINGS
                DEFINES += GPU
                DEFINES += CUDNN
                CONFIG += c++11

                INCLUDEPATH += F:\WORK\install\include
                INCLUDEPATH += F:\my_work\yolo-qt-master\src
                INCLUDEPATH += F:\my_work\yolo-qt-object-detection-master\3rdparty\include
                #INCLUDEPATH += F:\my_work\yolo-qt-object-detection-master\cudainclude

                DESTDIR = release
                OBJECTS_DIR = release/obj
                CUDA_OBJECTS_DIR = release/cuda
                CONFIG += console
                CONFIG -= app_bundle
                CONFIG += force_debug_info

                TEMPLATE = app

                #Enter your gencode here!
                GENCODE = arch=compute_52,code=sm_52

                #We must define this as we get some confilcs in minwindef.h and helper_math.h
                DEFINES += NOMINMAX

                CUDA_SOURCES += /*.cu
                #\

                F:/my_work/yolo-qt-master/src/*.c

                SOURCES += /.cu
                SOURCES -= /
                .cu

                CUDA with Windows

                #CUDA_DIR = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5"
                CUDA_DIR = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0"
                SYSTEM_NAME = x64         # Depending on your system either 'Win32', 'x64', or 'Win64'
                SYSTEM_TYPE = 64            # '32' or '64', depending on your system
                CUDA_ARCH = sm_30           # 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
                #INCLUDEPATH += "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include"
                INCLUDEPATH += "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include"
                
                #library directories
                #QMAKE_LIBDIR += $$join(CUDA_DIR,'" -I"','-I"','"')\lib\$$SYSTEM_NAME
                #QMAKE_LIBDIR += "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\lib\x64"
                QMAKE_LIBDIR += "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64"
                
                CUDA_LIBS = -lcuda -lcudart -lcufft -lcublas
                
                CUDA_INC += $$join(INCLUDEPATH,'" -I"','-I"','"')
                
                LIBS += $$CUDA_LIBS
                
                # 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){
                    cuda_d.input    = CUDA_SOURCES
                    cuda_d.output   = ${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   = ${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
                }
                

                TARGET = qt5_opencv3_darknet

                LIBS += F:\my_work\yolo-qt-object-detection-master\3rdparty\lib\x64\pthreadVC2.lib
                LIBS += F:\WORK\install\x64\vc14\lib\opencv_core320.lib
                LIBS += F:\WORK\install\x64\vc14\lib\opencv_highgui320.lib
                LIBS += F:\WORK\install\x64\vc14\lib\opencv_imgcodecs320.lib
                LIBS += F:\WORK\install\x64\vc14\lib\opencv_imgproc320.lib
                LIBS += F:\WORK\install\x64\vc14\lib\opencv_objdetect320.lib
                LIBS += F:\WORK\install\x64\vc14\lib\opencv_video320.lib
                LIBS += F:\WORK\install\x64\vc14\lib\opencv_videoio320.lib

                SOURCES += darknet.cpp
                main.cpp
                mainwindow.cpp
                player.cpp
                ../yolo-qt-master/src/art.c
                ../yolo-qt-master/src/yolo.c
                ../yolo-qt-master/src/convolutional_layer.c
                ../yolo-qt-master/src/writing.c
                ../yolo-qt-master/src/voxel.c
                ../yolo-qt-master/src/tag.c
                ../yolo-qt-master/src/swag.c
                ../yolo-qt-master/src/super.c
                ../yolo-qt-master/src/rnn_vid.c
                ../yolo-qt-master/src/rnn.c
                ../yolo-qt-master/src/nightmare.c
                ../yolo-qt-master/src/image.c
                ../yolo-qt-master/src/go.c
                ../yolo-qt-master/src/detector.c
                ../yolo-qt-master/src/darknet.c
                ../yolo-qt-master/src/coco.c
                ../yolo-qt-master/src/classifier.c
                ../yolo-qt-master/src/cifar.c
                ../yolo-qt-master/src/demo.c
                ../yolo-qt-master/src/activation_layer.c
                ../yolo-qt-master/src/activations.c
                ../yolo-qt-master/src/avgpool_layer.c
                ../yolo-qt-master/src/batchnorm_layer.c
                ../yolo-qt-master/src/blas.c
                ../yolo-qt-master/src/box.c
                ../yolo-qt-master/src/captcha.c
                ../yolo-qt-master/src/col2im.c
                ../yolo-qt-master/src/compare.c
                ../yolo-qt-master/src/connected_layer.c
                ../yolo-qt-master/src/cost_layer.c
                ../yolo-qt-master/src/cpu_gemm.c
                ../yolo-qt-master/src/crnn_layer.c
                ../yolo-qt-master/src/crop_layer.c
                ../yolo-qt-master/src/cuda.c
                ../yolo-qt-master/src/data.c
                ../yolo-qt-master/src/deconvolutional_layer.c
                ../yolo-qt-master/src/detection_layer.c
                ../yolo-qt-master/src/dice.c
                ../yolo-qt-master/src/dropout_layer.c
                ../yolo-qt-master/src/gemm.c
                ../yolo-qt-master/src/getopt.c
                ../yolo-qt-master/src/gettimeofday.c
                ../yolo-qt-master/src/gru_layer.c
                ../yolo-qt-master/src/im2col.c
                ../yolo-qt-master/src/layer.c
                ../yolo-qt-master/src/list.c
                ../yolo-qt-master/src/local_layer.c
                ../yolo-qt-master/src/matrix.c
                ../yolo-qt-master/src/maxpool_layer.c
                ../yolo-qt-master/src/network.c
                ../yolo-qt-master/src/normalization_layer.c
                ../yolo-qt-master/src/option_list.c
                ../yolo-qt-master/src/parser.c
                ../yolo-qt-master/src/region_layer.c
                ../yolo-qt-master/src/reorg_layer.c
                ../yolo-qt-master/src/rnn_layer.c
                ../yolo-qt-master/src/route_layer.c
                ../yolo-qt-master/src/shortcut_layer.c
                ../yolo-qt-master/src/softmax_layer.c
                ../yolo-qt-master/src/tree.c
                ../yolo-qt-master/src/utils.c

                FORMS +=
                mainwindow.ui

                HEADERS +=
                mainwindow.h
                player.h
                ../yolo-qt-master/src/activation_layer.h
                ../yolo-qt-master/src/activations.h
                ../yolo-qt-master/src/avgpool_layer.h
                ../yolo-qt-master/src/batchnorm_layer.h
                ../yolo-qt-master/src/blas.h
                ../yolo-qt-master/src/box.h
                ../yolo-qt-master/src/bugfixes.h
                ../yolo-qt-master/src/classifier.h
                ../yolo-qt-master/src/col2im.h
                ../yolo-qt-master/src/connected_layer.h
                ../yolo-qt-master/src/convolutional_layer.h
                ../yolo-qt-master/src/cost_layer.h
                ../yolo-qt-master/src/crnn_layer.h
                ../yolo-qt-master/src/crop_layer.h
                ../yolo-qt-master/src/cuda.h
                ../yolo-qt-master/src/data.h
                ../yolo-qt-master/src/deconvolutional_layer.h
                ../yolo-qt-master/src/demo.h
                ../yolo-qt-master/src/detection_layer.h
                ../yolo-qt-master/src/dropout_layer.h
                ../yolo-qt-master/src/gemm.h
                ../yolo-qt-master/src/gru_layer.h
                ../yolo-qt-master/src/im2col.h
                ../yolo-qt-master/src/image.h
                ../yolo-qt-master/src/layer.h
                ../yolo-qt-master/src/list.h
                ../yolo-qt-master/src/local_layer.h
                ../yolo-qt-master/src/matrix.h
                ../yolo-qt-master/src/maxpool_layer.h
                ../yolo-qt-master/src/network.h
                ../yolo-qt-master/src/normalization_layer.h
                ../yolo-qt-master/src/option_list.h
                ../yolo-qt-master/src/parser.h
                ../yolo-qt-master/src/region_layer.h
                ../yolo-qt-master/src/reorg_layer.h
                ../yolo-qt-master/src/rnn_layer.h
                ../yolo-qt-master/src/route_layer.h
                ../yolo-qt-master/src/shortcut_layer.h
                ../yolo-qt-master/src/softmax_layer.h
                ../yolo-qt-master/src/stb_image.h
                ../yolo-qt-master/src/stb_image_write.h
                ../yolo-qt-master/src/tree.h
                ../yolo-qt-master/src/utils.h
                3rdparty/include/pthread.h
                3rdparty/include/sched.h
                3rdparty/include/semaphore.h

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  slman_alii
                  wrote on last edited by
                  #8

                  i have also this problem
                  C:\Qt\Qt5.9.4\Tools\QtCreator\bin\jom.exe -f Makefile.Release
                  C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0/bin/nvcc.exe --use_fast_math -I"F:\WORK\install\include" -I"F:\my_work\yolo-qt-master\src" -I"F:\my_work\yolo-qt-object-detection-master\3rdparty\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0/include" F:\my_work\yolo-qt-object-detection-master\3rdparty\lib\x64\pthreadVC2.lib F:\WORK\install\x64\vc14\lib\opencv_core320.lib F:\WORK\install\x64\vc14\lib\opencv_highgui320.lib F:\WORK\install\x64\vc14\lib\opencv_imgcodecs320.lib F:\WORK\install\x64\vc14\lib\opencv_imgproc320.lib F:\WORK\install\x64\vc14\lib\opencv_objdetect320.lib F:\WORK\install\x64\vc14\lib\opencv_video320.lib F:\WORK\install\x64\vc14\lib\opencv_videoio320.lib -lcuda -lcudart -lcufft -lcublas --machine 64 -arch=sm_30 --compile -cudart static -DWIN32 -D_MBCS -Xcompiler /wd4819,/EHsc,/W3,/nologo,/O2,/Zi -Xcompiler /MD -c -o activation_kernels.o ..\activation_kernels.cu
                  nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Did you just take all the files of the project and put them in your project ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved