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. LNK1104: cannot open cuda.lib // CUDA 6.5 on Qt creator
Forum Updated to NodeBB v4.3 + New Features

LNK1104: cannot open cuda.lib // CUDA 6.5 on Qt creator

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.8k Views 1 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.
  • G Offline
    G Offline
    gj21kr
    wrote on last edited by gj21kr
    #1

    Hello there,

    I want to use my gtx 980 ti for cuda FFT programming.
    My project should be coded on Win32 to link various libraries.
    So, I installed CUDA 6.5 integrated with visual studio 2010.
    My framework for my application is Qt Creator 4.3 with Qt library 4.8.6.

    When I compiled my program I got the following error:
    LINK : fatal error LNK1104: cannot open file 'cuda.lib'
    jom: D:\sdkk_beta_cpy\demo_7\build-qt-Desktop-Debug\Makefile.Debug [debug\QtCuda.exe] Error 1104
    jom: D:\sdkk_beta_cpy\demo_7\build-qt-Desktop-Debug\Makefile [debug] Error 2

    how can I fix it?

    Best,

    ===============================================================================
    QT += core

    TARGET = QtCuda
    CONFIG += console
    CONFIG -= app_bundle
    TEMPLATE = app

    HEADERS +=
    1.h
    2.h
    3.h \

    SOURCES +=
    1.cpp
    main.cpp
    2.cpp
    3.cpp \

    FORMS +=
    myUI.ui \

    RESOURCES +=
    myApp.qrc

    OTHER_FILES +=
    res/u.ico
    res/stop.png
    res/run.png
    res/init.png \

    INCLUDEPATH += ../../inc/
    INCLUDEPATH += ../../../

    //# CUDA settings <-- may change depending on your system
    CUDA_SOURCES += "D:/sdkk_beta_cpy/demo_7/qt/pitchhilbert.cu"
    "D:/sdkk_beta_cpy/demo_7/qt/pitchtable.cu"
    CUDA_SDK = "D:/Programes/NVIDIA/NVIDIA GPU Computing SDK 4.0/C" # Path to cuda SDK install
    CUDA_DIR = "D:/Programes/NVIDIA/CUDA6.5/toolkit" # Path to cuda toolkit install
    SYSTEM_NAME = Win32 # Depending on your system either 'Win32', 'x64', or 'Win64'
    SYSTEM_TYPE = 64 # '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_SDK/common/inc/
    //# $$CUDA_SDK/../shared/inc/
    INCLUDEPATH += "D:/Programes/NVIDIA/CUDA6.5/toolkit/include"
    INCLUDEPATH += "D:/Programes/NVIDIA/NVIDIA GPU Computing SDK 4.0/C/common/lib/Win32"
    INCLUDEPATH += "D:/Programes/NVIDIA/NVIDIA GPU Computing SDK 4.0/shared/inc"

    //# library directories
    //#QMAKE_LIBDIR += $$CUDA_DIR/lib/$$SYSTEM_NAME
    //# $$CUDA_SDK/common/lib/$$SYSTEM_NAME
    //# $$CUDA_SDK/../shared/lib/$$SYSTEM_NAME
    QMAKE_LIBDIR += "D:/Programes/NVIDIA/CUDA6.5/toolkit/include"
    QMAKE_LIBDIR += "D:/Programes/NVIDIA/NVIDIA GPU Computing SDK 4.0/C/common/lib/Win32"
    QMAKE_LIBDIR += "D:/Programes/NVIDIA/NVIDIA GPU Computing SDK 4.0/shared/lib/Win32"

    //# Add the necessary libraries
    //#INCLUDEPATH += "D:/Programes/NVIDIA/CUDA6.5/toolkit/lib/Win32"
    LIBS += -lcuda -lcudart -lcufft

    //# The following library conflicts with something in Cuda
    //#QMAKE_LFLAGS_RELEASE = /NODEFAULTLIB:msvcrt.lib
    //#QMAKE_LFLAGS_DEBUG = /NODEFAULTLIB:msvcrtd.lib

    //# The following makes sure all path names (which often include spaces) are put between quotation marks
    CUDA_INC = $$join(INCLUDEPATH,'" -I"','-I"','"')

    //# 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
    }

    raven-worxR 1 Reply Last reply
    0
    • G gj21kr

      Hello there,

      I want to use my gtx 980 ti for cuda FFT programming.
      My project should be coded on Win32 to link various libraries.
      So, I installed CUDA 6.5 integrated with visual studio 2010.
      My framework for my application is Qt Creator 4.3 with Qt library 4.8.6.

      When I compiled my program I got the following error:
      LINK : fatal error LNK1104: cannot open file 'cuda.lib'
      jom: D:\sdkk_beta_cpy\demo_7\build-qt-Desktop-Debug\Makefile.Debug [debug\QtCuda.exe] Error 1104
      jom: D:\sdkk_beta_cpy\demo_7\build-qt-Desktop-Debug\Makefile [debug] Error 2

      how can I fix it?

      Best,

      ===============================================================================
      QT += core

      TARGET = QtCuda
      CONFIG += console
      CONFIG -= app_bundle
      TEMPLATE = app

      HEADERS +=
      1.h
      2.h
      3.h \

      SOURCES +=
      1.cpp
      main.cpp
      2.cpp
      3.cpp \

      FORMS +=
      myUI.ui \

      RESOURCES +=
      myApp.qrc

      OTHER_FILES +=
      res/u.ico
      res/stop.png
      res/run.png
      res/init.png \

      INCLUDEPATH += ../../inc/
      INCLUDEPATH += ../../../

      //# CUDA settings <-- may change depending on your system
      CUDA_SOURCES += "D:/sdkk_beta_cpy/demo_7/qt/pitchhilbert.cu"
      "D:/sdkk_beta_cpy/demo_7/qt/pitchtable.cu"
      CUDA_SDK = "D:/Programes/NVIDIA/NVIDIA GPU Computing SDK 4.0/C" # Path to cuda SDK install
      CUDA_DIR = "D:/Programes/NVIDIA/CUDA6.5/toolkit" # Path to cuda toolkit install
      SYSTEM_NAME = Win32 # Depending on your system either 'Win32', 'x64', or 'Win64'
      SYSTEM_TYPE = 64 # '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_SDK/common/inc/
      //# $$CUDA_SDK/../shared/inc/
      INCLUDEPATH += "D:/Programes/NVIDIA/CUDA6.5/toolkit/include"
      INCLUDEPATH += "D:/Programes/NVIDIA/NVIDIA GPU Computing SDK 4.0/C/common/lib/Win32"
      INCLUDEPATH += "D:/Programes/NVIDIA/NVIDIA GPU Computing SDK 4.0/shared/inc"

      //# library directories
      //#QMAKE_LIBDIR += $$CUDA_DIR/lib/$$SYSTEM_NAME
      //# $$CUDA_SDK/common/lib/$$SYSTEM_NAME
      //# $$CUDA_SDK/../shared/lib/$$SYSTEM_NAME
      QMAKE_LIBDIR += "D:/Programes/NVIDIA/CUDA6.5/toolkit/include"
      QMAKE_LIBDIR += "D:/Programes/NVIDIA/NVIDIA GPU Computing SDK 4.0/C/common/lib/Win32"
      QMAKE_LIBDIR += "D:/Programes/NVIDIA/NVIDIA GPU Computing SDK 4.0/shared/lib/Win32"

      //# Add the necessary libraries
      //#INCLUDEPATH += "D:/Programes/NVIDIA/CUDA6.5/toolkit/lib/Win32"
      LIBS += -lcuda -lcudart -lcufft

      //# The following library conflicts with something in Cuda
      //#QMAKE_LFLAGS_RELEASE = /NODEFAULTLIB:msvcrt.lib
      //#QMAKE_LFLAGS_DEBUG = /NODEFAULTLIB:msvcrtd.lib

      //# The following makes sure all path names (which often include spaces) are put between quotation marks
      CUDA_INC = $$join(INCLUDEPATH,'" -I"','-I"','"')

      //# 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
      }

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @gj21kr
      where do you have this qmake code from?
      QMAKE_LIBDIR should actually be LIBS (use -L to specify the path)

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      G 1 Reply Last reply
      1
      • raven-worxR raven-worx

        @gj21kr
        where do you have this qmake code from?
        QMAKE_LIBDIR should actually be LIBS (use -L to specify the path)

        G Offline
        G Offline
        gj21kr
        wrote on last edited by
        #3

        @raven-worx

        Thanks! I fixed it

        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