我是Ubuntu-Qt-OpenCV-OpenGL世界的新手(但是大学以某种方式假设我已经知道很多年了),并且在运行有关OpenGL的QT示例时遇到了麻烦。
例如,在多维数据集示例中,我得到的错误是:
No rule to make target 'objectloader.cpp', needed by 'objectloader.o'. Stop.
这是文件夹,您可以在其中检查.pro,.cpp,标头和所有文件。我只编辑了cube.pro。 https://drive.google.com/file/d/1-H6uI3Tf9xgNDTLjNmWMc2GE5Il8ZvMI/view?usp=sharing (顺便说一下,没有激活shadowbuild)
如果我错过了某些东西,这是我所有已安装软件包的列表
sudo apt list --installed
https://drive.google.com/file/d/1EbL2cojkwPAejefhrROLsGigEHMy4ua_/view?usp=sharing
我目前正在与:
操作系统:Ubuntu 18.04.1 LTS
内核:4.16.0-041600-通用
Cuda:基于Tue_Jun_12_23:07:04_CDT_2018 Cuda编译工具,9.2版,V9.2.148
gcc:(Ubuntu 7.3.0-27ubuntu1〜18.04)7.3.0
QMake:3.1版
Qt版本:5.9.6
OpenGL版本:3.0 Mesa 18.0.5
OpenCV版本:4.0.0(通过命令cat /home/pablo/OpenCV-3.0.0/OpenCV-3.0.0-master/opencv/build/OpenCVConfig.cmake获得 )
据我了解,示例旨在在您尝试示例后立即起作用,因此我认为问题可能不是丢失的文件或类似的东西,但我找不到'objectloader.cpp ”或“ objectloader.o”文件。
我认为问题可能是由OpenCV 4安装在不同于以前的OpenCV版本的另一个文件位置引起的,因为几乎所有“仅在控制台上键入此代码”代码都无法直接工作
pkg-config --modversion opencv
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
感谢大家花时间为我提供帮助,我试图将所有我能想到的都包括在内,但是要跟踪过去三天的教程和示例中的所有内容有点困难。如果还有其他我可以在这里包括的东西,请索要。谢谢。
这是cube.pro文件
QT += core gui widgets
TARGET = cube
TEMPLATE = app
SOURCES += main.cpp
SOURCES += \
mainwidget.cpp \
geometryengine.cpp
HEADERS += \
mainwidget.h \
geometryengine.h
RESOURCES += \
shaders.qrc \
textures.qrc
LIBRARYDIRS = src/Library
LIBRARYDIRS += src/TheOtherLibrary
# install
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/cube
INSTALLS += target
QT -= gui
CONFIG += c++11 console
CONFIG -= app_bundle
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
INCLUDEPATH += /usr/include
INCLUDEPATH += /usr/local/include
INCLUDEPATH += /usr/local/include/opencv4
LIBS += -lGL -lGLEW -lglfw -lglut -lGLU -lassimp -ldl -lm -lstdc++fs
LIBS += -I/usr/local/include/opencv4 -I/usr/local/include/opencv4 -L/usr/local/lib -lopencv_gapi -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dpm -lopencv_face -lopencv_photo -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_line_descriptor -lopencv_optflow -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_surface_matching -lopencv_tracking -lopencv_video -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_flann -lopencv_xphoto -lopencv_imgproc -lopencv_core
SOURCES += \
main.cpp \
objectloader.cpp \
model.cpp \
glad.c
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
objectloader.h \
stb_image.h \
shader_m.h \
camera.h \
model.h \
mesh.h \
glad.h