Build QT project with CUDA caused pch error
Unsolved
General and Desktop
-
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?
-
@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>