0

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 "Cannot open include file: : 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?

EDIT------ So i am on a Windows 7 64 bit with both visual studio 2015 and visual studio 2012. I had a version of QT which doesn't compile with msvc 2015, that's why i compiled in 32 bit. I changed my version of QT to compile in 64 Bit. Actually, the error message i got is:

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

---EDIT 2 I've get rid of this error by not using the pch in my cu file. I think the compiler didn't understand the pch. But i still have error messages coming from a CUDA file: inside device_types.h

C2236: unexpected token 'enum'. Did you forget a ';' ÿ? device_types.h line 61
C2143: syntax error : missing ';' before '{' device_types.h line 62
C2447: '{' ÿ: missing function header (old style format listÿ?) device_types.h line 62

I didn't change anything in these files so i quite don't understand why i get these error? Do you guys have an idea?

miyoku
  • 107
  • 1
  • 13
  • In addition to your .pro file, I'm sure it would be useful if you provided a sample of the exact error output. I personally don't recommend trying to build a win32/32-bit project on windows/ CUDA 8 but it is technically still supported, assuming your base OS is a 64-bit OS. – Robert Crovella Aug 10 '17 at 14:48
  • Hi thanks for your answer, i edited my subject to give you a sample. – miyoku Aug 11 '17 at 07:06
  • That error in your edit has absolutely nothing to do with CUDA – talonmies Aug 11 '17 at 08:12
  • I know that's why it confuse me. but if i remove all the cuda integration from my .pro file. My project works fine. That's why i assume it comes from the cuda part – miyoku Aug 11 '17 at 08:17
  • I've succeed to get rid of the pch error but a cuda file send me an error. I think it means something is not defined correctly or something like that. But this file is defined in the cuda libraries – miyoku Aug 16 '17 at 09:27

0 Answers0