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. Build QT project with CUDA caused pch error

Build QT project with CUDA caused pch error

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 892 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.
  • M Offline
    M Offline
    Miyoku
    wrote on last edited by
    #1

    Hi
    I'm not an expert of qmake still I'm trying to use CUDA on QT. When I tried to run it with CUDA, it gives me an error for each QT libraries in my pch file:

    error c1083 cannot open include file: 'QtWidgets/QOpenGLWidget' no such file or directory
    

    Is there a link between my integration of CUDA and my pch file?

    Here is my .pro file:

        #-------------------------------------------------
    #
    # Project created by QtCreator 2017-07-19T14:37:11
    #
    #-------------------------------------------------
    
    QT       += core gui
    QT += opengl
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = GUI_CUDA
    TEMPLATE = app
    
    
    SOURCES += main.cpp\
            mainwindow.cpp \
        Console.cpp \
        recorder.cpp \
        LIB_TIFF/tif_aux.c \
        LIB_TIFF/tif_close.c \
        LIB_TIFF/tif_codec.c \
        LIB_TIFF/tif_color.c \
        LIB_TIFF/tif_compress.c \
        LIB_TIFF/tif_dir.c \
        LIB_TIFF/tif_dirinfo.c \
        LIB_TIFF/tif_dirread.c \
        LIB_TIFF/tif_dirwrite.c \
        LIB_TIFF/tif_dumpmode.c \
        LIB_TIFF/tif_error.c \
        LIB_TIFF/tif_extension.c \
        LIB_TIFF/tif_fax3.c \
        LIB_TIFF/tif_fax3sm.c \
        LIB_TIFF/tif_flush.c \
        LIB_TIFF/tif_getimage.c \
        LIB_TIFF/tif_jbig.c \
        LIB_TIFF/tif_jpeg.c \
        LIB_TIFF/tif_jpeg_12.c \
        LIB_TIFF/tif_luv.c \
        LIB_TIFF/tif_lzma.c \
        LIB_TIFF/tif_lzw.c \
        LIB_TIFF/tif_next.c \
        LIB_TIFF/tif_ojpeg.c \
        LIB_TIFF/tif_open.c \
        LIB_TIFF/tif_packbits.c \
        LIB_TIFF/tif_pixarlog.c \
        LIB_TIFF/tif_predict.c \
        LIB_TIFF/tif_print.c \
        LIB_TIFF/tif_read.c \
        LIB_TIFF/tif_strip.c \
        LIB_TIFF/tif_swab.c \
        LIB_TIFF/tif_thunder.c \
        LIB_TIFF/tif_tile.c \
        LIB_TIFF/tif_version.c \
        LIB_TIFF/tif_warning.c \
        LIB_TIFF/tif_win32.c \
        LIB_TIFF/tif_write.c \
        LIB_TIFF/tif_zip.c \
        nvSDIutil.cpp \
        nvSDIin.cpp \
        anccapture.cpp \
        myopenglwidget.cpp \
        readwidget.cpp \
    
    HEADERS  += mainwindow.h \
        recorder.h \
        nvSDIutil.h \
        nvSDIin.h \
        anccapture.h \
        myopenglwidget.h \
        readwidget.h \
        cugl.h
    
    
    FORMS    += mainwindow.ui \
        readwidget.ui
    
    PRECOMPILED_HEADER = common.h
    
    #Path to glew SDK
    GLEW_DIR = "C:\glew\glew-2.0.0-win32\glew-2.0.0"
    INCLUDEPATH  += $$GLEW_DIR/include/GL
    QMAKE_LIBDIR += $$GLEW_DIR/lib/Release/x64
    QMAKE_LIBDIR += $$GLEW_DIR/bin/Release/x64
    LIBS += -lglew32 -lglew32s -lopengl32
    
    
    #Path to SDI_capture SDK
    SDI_CAPTURE_DIR = "C:\Program Files (x86)\NVIDIA Corporation\NVIDIA Quadro SDI Video SDK for OpenGL"
    # Path to header and libs files
    INCLUDEPATH  += $$SDI_CAPTURE_DIR/win/include
    INCLUDEPATH  += $$SDI_CAPTURE_DIR/win/include/GL
    INCLUDEPATH  += $$SDI_CAPTURE_DIR/win/examples/common
    QMAKE_LIBDIR += $$SDI_CAPTURE_DIR/win/lib64
    LIBS += -lANCapi -lcutil64 -lcutil64D -lnvapi64 -lNvCpl
    LIBS += -lUser32
    
    DISTFILES += cugl.cu
    
    # Cuda sources
    CUDA_SOURCES += cugl.cu
    
    CUDA_DIR="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0"
    
    SYSTEM_NAME = Win64         # Depending on your system either 'Win32', 'x64', or 'Win64'
    SYSTEM_TYPE = 64            # '32' or '64', depending on your system
    CUDA_ARCH = sm_35           # Type of CUDA architecture, for example 'compute_10', 'compute_11', 'sm_10'
    NVCC_OPTIONS = --use_fast_math
    
    
    # include paths
    INCLUDEPATH += $$CUDA_DIR/include
    
    # library directories
    QMAKE_LIBDIR += $$CUDA_DIR/lib/
    
    # GPU architecture
    CUDA_ARCH     = sm_35
    
    # Here are some NVCC flags I've always used by default.
    NVCCFLAGS     = --use_fast_math #--compiler-options
    
    
    # Prepare the extra compiler configuration (taken from the nvidia forum - i'm not an expert in this part)
    CUDA_INC = $$join(INCLUDEPATH,'" -I"','-I"','"')
    
    
    # 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"
    
    QMAKE_LFLAGS_RELEASE = /NODEFAULTLIB:msvcrt.lib
    QMAKE_LFLAGS_DEBUG   = /NODEFAULTLIB:msvcrt.lib
    
    # Configuration of the Cuda compiler
    
    CONFIG(debug, debug|release){
        # Debug mode
        cuda_d.input = CUDA_SOURCES
        cuda_d.output = ./${QMAKE_FILE_BASE}.obj
        cuda_d.commands = $$CUDA_DIR/bin/nvcc.exe -D_DEBUG -c -Xcompiler $$MSVCRT_LINK_FLAG_DEBUG $$CUDA_INC --machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH
        cuda_d.commands += ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT}
                       #$$LIBS
    
        cuda_d.dependency_type = TYPE_C
        #cuda.depend_command = $$CUDA_DIR/bin/nvcc -O3 -M $$CUDA_INC $$NVCCFLAGS ${QMAKE_FILE_NAME}
        QMAKE_EXTRA_COMPILERS += cuda_d
    }
    else{
        # Release mode
        cuda.input = CUDA_SOURCES
        cuda.output = ./${QMAKE_FILE_BASE}.obj
        cuda.commands = $$CUDA_DIR/bin/nvcc.exe -c -Xcompiler $$MSVCRT_LINK_FLAG_RELEASE $$CUDA_INC --machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH
        cuda.commands += ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT}
                       #$$LIBS
    
        cuda.dependency_type = TYPE_C
        #cuda.depend_command = $$CUDA_DIR/bin/nvcc -O3 -M $$CUDA_INC $$NVCCFLAGS ${QMAKE_FILE_NAME}
        QMAKE_EXTRA_COMPILERS += cuda
    }
    

    Do you have any ideas?

    jsulmJ 1 Reply Last reply
    1
    • M Miyoku

      Hi
      I'm not an expert of qmake still I'm trying to use CUDA on QT. When I tried to run it with CUDA, it gives me an error for each QT libraries in my pch file:

      error c1083 cannot open include file: 'QtWidgets/QOpenGLWidget' no such file or directory
      

      Is there a link between my integration of CUDA and my pch file?

      Here is my .pro file:

          #-------------------------------------------------
      #
      # Project created by QtCreator 2017-07-19T14:37:11
      #
      #-------------------------------------------------
      
      QT       += core gui
      QT += opengl
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      TARGET = GUI_CUDA
      TEMPLATE = app
      
      
      SOURCES += main.cpp\
              mainwindow.cpp \
          Console.cpp \
          recorder.cpp \
          LIB_TIFF/tif_aux.c \
          LIB_TIFF/tif_close.c \
          LIB_TIFF/tif_codec.c \
          LIB_TIFF/tif_color.c \
          LIB_TIFF/tif_compress.c \
          LIB_TIFF/tif_dir.c \
          LIB_TIFF/tif_dirinfo.c \
          LIB_TIFF/tif_dirread.c \
          LIB_TIFF/tif_dirwrite.c \
          LIB_TIFF/tif_dumpmode.c \
          LIB_TIFF/tif_error.c \
          LIB_TIFF/tif_extension.c \
          LIB_TIFF/tif_fax3.c \
          LIB_TIFF/tif_fax3sm.c \
          LIB_TIFF/tif_flush.c \
          LIB_TIFF/tif_getimage.c \
          LIB_TIFF/tif_jbig.c \
          LIB_TIFF/tif_jpeg.c \
          LIB_TIFF/tif_jpeg_12.c \
          LIB_TIFF/tif_luv.c \
          LIB_TIFF/tif_lzma.c \
          LIB_TIFF/tif_lzw.c \
          LIB_TIFF/tif_next.c \
          LIB_TIFF/tif_ojpeg.c \
          LIB_TIFF/tif_open.c \
          LIB_TIFF/tif_packbits.c \
          LIB_TIFF/tif_pixarlog.c \
          LIB_TIFF/tif_predict.c \
          LIB_TIFF/tif_print.c \
          LIB_TIFF/tif_read.c \
          LIB_TIFF/tif_strip.c \
          LIB_TIFF/tif_swab.c \
          LIB_TIFF/tif_thunder.c \
          LIB_TIFF/tif_tile.c \
          LIB_TIFF/tif_version.c \
          LIB_TIFF/tif_warning.c \
          LIB_TIFF/tif_win32.c \
          LIB_TIFF/tif_write.c \
          LIB_TIFF/tif_zip.c \
          nvSDIutil.cpp \
          nvSDIin.cpp \
          anccapture.cpp \
          myopenglwidget.cpp \
          readwidget.cpp \
      
      HEADERS  += mainwindow.h \
          recorder.h \
          nvSDIutil.h \
          nvSDIin.h \
          anccapture.h \
          myopenglwidget.h \
          readwidget.h \
          cugl.h
      
      
      FORMS    += mainwindow.ui \
          readwidget.ui
      
      PRECOMPILED_HEADER = common.h
      
      #Path to glew SDK
      GLEW_DIR = "C:\glew\glew-2.0.0-win32\glew-2.0.0"
      INCLUDEPATH  += $$GLEW_DIR/include/GL
      QMAKE_LIBDIR += $$GLEW_DIR/lib/Release/x64
      QMAKE_LIBDIR += $$GLEW_DIR/bin/Release/x64
      LIBS += -lglew32 -lglew32s -lopengl32
      
      
      #Path to SDI_capture SDK
      SDI_CAPTURE_DIR = "C:\Program Files (x86)\NVIDIA Corporation\NVIDIA Quadro SDI Video SDK for OpenGL"
      # Path to header and libs files
      INCLUDEPATH  += $$SDI_CAPTURE_DIR/win/include
      INCLUDEPATH  += $$SDI_CAPTURE_DIR/win/include/GL
      INCLUDEPATH  += $$SDI_CAPTURE_DIR/win/examples/common
      QMAKE_LIBDIR += $$SDI_CAPTURE_DIR/win/lib64
      LIBS += -lANCapi -lcutil64 -lcutil64D -lnvapi64 -lNvCpl
      LIBS += -lUser32
      
      DISTFILES += cugl.cu
      
      # Cuda sources
      CUDA_SOURCES += cugl.cu
      
      CUDA_DIR="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0"
      
      SYSTEM_NAME = Win64         # Depending on your system either 'Win32', 'x64', or 'Win64'
      SYSTEM_TYPE = 64            # '32' or '64', depending on your system
      CUDA_ARCH = sm_35           # Type of CUDA architecture, for example 'compute_10', 'compute_11', 'sm_10'
      NVCC_OPTIONS = --use_fast_math
      
      
      # include paths
      INCLUDEPATH += $$CUDA_DIR/include
      
      # library directories
      QMAKE_LIBDIR += $$CUDA_DIR/lib/
      
      # GPU architecture
      CUDA_ARCH     = sm_35
      
      # Here are some NVCC flags I've always used by default.
      NVCCFLAGS     = --use_fast_math #--compiler-options
      
      
      # Prepare the extra compiler configuration (taken from the nvidia forum - i'm not an expert in this part)
      CUDA_INC = $$join(INCLUDEPATH,'" -I"','-I"','"')
      
      
      # 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"
      
      QMAKE_LFLAGS_RELEASE = /NODEFAULTLIB:msvcrt.lib
      QMAKE_LFLAGS_DEBUG   = /NODEFAULTLIB:msvcrt.lib
      
      # Configuration of the Cuda compiler
      
      CONFIG(debug, debug|release){
          # Debug mode
          cuda_d.input = CUDA_SOURCES
          cuda_d.output = ./${QMAKE_FILE_BASE}.obj
          cuda_d.commands = $$CUDA_DIR/bin/nvcc.exe -D_DEBUG -c -Xcompiler $$MSVCRT_LINK_FLAG_DEBUG $$CUDA_INC --machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH
          cuda_d.commands += ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT}
                         #$$LIBS
      
          cuda_d.dependency_type = TYPE_C
          #cuda.depend_command = $$CUDA_DIR/bin/nvcc -O3 -M $$CUDA_INC $$NVCCFLAGS ${QMAKE_FILE_NAME}
          QMAKE_EXTRA_COMPILERS += cuda_d
      }
      else{
          # Release mode
          cuda.input = CUDA_SOURCES
          cuda.output = ./${QMAKE_FILE_BASE}.obj
          cuda.commands = $$CUDA_DIR/bin/nvcc.exe -c -Xcompiler $$MSVCRT_LINK_FLAG_RELEASE $$CUDA_INC --machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH
          cuda.commands += ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT}
                         #$$LIBS
      
          cuda.dependency_type = TYPE_C
          #cuda.depend_command = $$CUDA_DIR/bin/nvcc -O3 -M $$CUDA_INC $$NVCCFLAGS ${QMAKE_FILE_NAME}
          QMAKE_EXTRA_COMPILERS += cuda
      }
      

      Do you have any ideas?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Miyoku said in Build QT project with CUDA caused pch error:

      'QtWidgets/QOpenGLWidget'

      Remove QtWidgets from the include, it is enough to do

      #include <QOpenGLWidget>
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      • Login

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