Using OpenCV Mac Framework with QT5 on Mojhave



  • Hi,

    I am trying to use the OpenCV2 Framework together with QT5 on Mac OS 10.14. The qmake runs fine, but while linking it fails with the error message below. Note: I had to symlink the Heiders directory to $$PWD/opencv2 to get the Headers correctly found. If this is totally wrong please point me to an working example/tutorial, how to include external Frameworks correctly.
    #My *.pro file
    [0_1545161380067_qt-test.pro](Uploading 100%)

    #Error message from compile output
    /Applications/Extras/development/Qt/5.11.3/clang_64/bin/uic mainwindow.ui -o ui_mainwindow.h
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.14 -Wall -W -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/ -Iopencv2 -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtWidgets.framework/Headers -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtGui.framework/Headers -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I/Applications/Extras/development/Qt/5.11.3/clang_64/mkspecs/macx-clang -F/Applications/Extras/development/Qt/5.11.3/clang_64/lib -o main.o main.cpp
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.14 -Wall -W -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/ -Iopencv2 -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtWidgets.framework/Headers -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtGui.framework/Headers -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I/Applications/Extras/development/Qt/5.11.3/clang_64/mkspecs/macx-clang -F/Applications/Extras/development/Qt/5.11.3/clang_64/lib -o camviewer.o camviewer.cpp
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.14 -Wall -W -dM -E -o moc_predefs.h /Applications/Extras/development/Qt/5.11.3/clang_64/mkspecs/features/data/dummy.cpp
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.14 -Wall -W -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/ -Iopencv2 -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtWidgets.framework/Headers -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtGui.framework/Headers -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I/Applications/Extras/development/Qt/5.11.3/clang_64/mkspecs/macx-clang -F/Applications/Extras/development/Qt/5.11.3/clang_64/lib -o mainwindow.o mainwindow.cpp
    /Applications/Extras/development/Qt/5.11.3/clang_64/bin/moc -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --include /Users/ademmler/QtProjects/qt-test/moc_predefs.h -I/Applications/Extras/development/Qt/5.11.3/clang_64/mkspecs/macx-clang -I/Users/ademmler/QtProjects/qt-test -I/ -I/Users/ademmler/QtProjects/qt-test/opencv2 -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtWidgets.framework/Headers -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtGui.framework/Headers -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtCore.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -F/Applications/Extras/development/Qt/5.11.3/clang_64/lib mainwindow.h -o moc_mainwindow.cpp
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.14 -Wall -W -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/ -Iopencv2 -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtWidgets.framework/Headers -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtGui.framework/Headers -I/Applications/Extras/development/Qt/5.11.3/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I/Applications/Extras/development/Qt/5.11.3/clang_64/mkspecs/macx-clang -F/Applications/Extras/development/Qt/5.11.3/clang_64/lib -o moc_mainwindow.o moc_mainwindow.cpp
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib=libc++ -F/Users/ademmler/QtProjects/qt-test/Frameworks/opencv2 -headerpad_max_install_names -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.14 -Wl,-rpath,@executable_path/Frameworks -Wl,-rpath,/Applications/Extras/development/Qt/5.11.3/clang_64/lib -o qt-test.app/Contents/MacOS/qt-test main.o mainwindow.o camviewer.o moc_mainwindow.o -F/Applications/Extras/development/Qt/5.11.3/clang_64/lib -framework QtWidgets -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
    ld: warning: directory not found for option '-F/Users/ademmler/QtProjects/qt-test/Frameworks/opencv2'
    Undefined symbols for architecture x86_64:
    "cv::VideoCapture::open(int)", referenced from:
    MainWindow::on_pushButton_clicked() in mainwindow.o
    "cv::VideoCapture::release()", referenced from:
    MainWindow::~MainWindow() in mainwindow.o
    MainWindow::on_pushButton_clicked() in mainwindow.o
    "cv::VideoCapture::VideoCapture()", referenced from:
    MainWindow::MainWindow(QWidget*) in mainwindow.o
    "cv::VideoCapture::~VideoCapture()", referenced from:
    MainWindow::MainWindow(QWidget*) in mainwindow.o
    MainWindow::~MainWindow() in mainwindow.o
    "cv::VideoCapture::operator>>(cv::Mat&)", referenced from:
    MainWindow::updateView() in mainwindow.o
    "cv::Mat::deallocate()", referenced from:
    cv::Mat::release() in mainwindow.o
    "cv::fastFree(void*)", referenced from:
    cv::Mat::~Mat() in mainwindow.o
    "cv::VideoCapture::isOpened() const", referenced from:
    MainWindow::~MainWindow() in mainwindow.o
    MainWindow::on_pushButton_clicked() in mainwindow.o
    MainWindow::updateView() in mainwindow.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [qt-test.app/Contents/MacOS/qt-test] Error 1
    20:20:58: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project qt-test (kit: Qt 5.11.3 clang 64bit)
    When executing step "Make"
    20:20:58: Elapsed time: 00:03.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Where is your OpenCV framework exactly located ?
    Adding that symlink only shows that there's something wrong. It's not a solution.



  • @ademmler

    1. could you please share your .pro file?

    I'm asking because OpenCV seems to be picky to the order their modules (.so files) are used during linking, see this post (although focus on Android) about some insight that may apply as well.



  • @SGaist Hi, thx for your response. Yes you are right. The symlink was needed to get QT to recognize the Header files. But still I can't compile. Here is the ls output from my test case.

    drwxr-xr-x 4 ademmler staff 128 18 Dez 19:53 Frameworks
    -rw-r--r-- 1 ademmler staff 71090 18 Dez 20:20 Makefile
    -rwxr-xr-x@ 1 ademmler staff 232 11 Dez 18:21 README.md
    -rwxr-xr-x 1 ademmler staff 452 13 Dez 00:45 camviewer.cpp
    -rwxr-xr-x@ 1 ademmler staff 452 11 Dez 18:21 camviewer.h
    -rw-r--r-- 1 ademmler staff 713992 18 Dez 20:20 camviewer.o
    -rwxr-xr-x@ 1 ademmler staff 172 11 Dez 18:21 main.cpp
    -rw-r--r-- 1 ademmler staff 871776 18 Dez 20:20 main.o
    -rwxr-xr-x 1 ademmler staff 1278 18 Dez 17:44 mainwindow.cpp
    -rwxr-xr-x 1 ademmler staff 545 18 Dez 20:13 mainwindow.h
    -rw-r--r-- 1 ademmler staff 953816 18 Dez 20:20 mainwindow.o
    -rwxr-xr-x@ 1 ademmler staff 1798 11 Dez 18:21 mainwindow.ui
    -rw-r--r-- 1 ademmler staff 3573 18 Dez 20:20 moc_mainwindow.cpp
    -rw-r--r-- 1 ademmler staff 757452 18 Dez 20:20 moc_mainwindow.o
    -rw-r--r-- 1 ademmler staff 12987 18 Dez 20:20 moc_predefs.h
    lrwxr-xr-x 1 ademmler staff 82 18 Dez 19:56 opencv2 -> /Users/ademmler/QtProjects/qt-test/Frameworks/opencv2.framework/Versions/A/Headers
    drwxr-xr-x 3 ademmler staff 96 18 Dez 20:20 qt-test.app
    -rwxr-xr-x 1 ademmler staff 1280 18 Dez 20:20 qt-test.pro
    -rw-r--r-- 1 ademmler staff 24019 18 Dez 20:28 qt-test.pro.user
    -rw-r--r-- 1 ademmler staff 2771 18 Dez 20:20 ui_mainwindow.h

    And here is my *pro file:

    @Pablo-J.-Rogina Hi, thx for you response. I had uploaded my *.pro file with my initial post.
    Have I done wrong? Here is a copy & paste Version. I have left also commented code from my different tryout in the pro file. thx Alexander

    #-------------------------------------------------

    Project created by QtCreator 2016-06-07T18:10:12

    #-------------------------------------------------

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    CONFIG += sdk_no_version_check
    CONFIG -= app

    QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14

    TARGET = qt-test
    TEMPLATE = app

    DEFINES += QT_DEPRECATED_WARNINGS
    CONFIG += c++11

    SOURCES += main.cpp
    mainwindow.cpp
    camviewer.cpp

    HEADERS += mainwindow.h
    camviewer.h
    $$PWD/opencv2/core.hpp
    $$PWD/opencv2/highgui.hpp

    FORMS += mainwindow.ui

    INCLUDEPATH += /.
    DEPENDPATH += /.

    INCLUDEPATH += $$PWD/opencv2
    DEPENDPATH += $$PWD/opencv2

    QMAKE_LFLAGS += -F$$PWD/Frameworks/opencv2
    #LIBS += -F$$PWD/Frameworks/ -framework opencv2

    DRIVER_FRAMEWORKS.files += $$PWD/Frameworks/opencv2.framework
    DRIVER_FRAMEWORKS.path = Contents/Frameworks
    QMAKE_BUNDLE_DATA += DRIVER_FRAMEWORKS

    #QMAKE_LFLAGS += -F$$PWD/Frameworks/opencv2.framework
    #LIBS += $$PWD/Frameworks/opencv2.framework/Versions/A/opencv2
    #LIBS += -F$$PWD/Frameworks/opencv2.framework
    #LIBS += -L$$PWD/Frameworks/opencv2.framework/Versions/A/


  • Lifetime Qt Champion

    The LIBS += -F$$PWD/Frameworks/ -framework opencv2 line should be enough to make it work.

    How did you get OpenCV ?



  • @SGaist
    I got it from the opencv website as well I compiled it myself. I also tried, the mac ports version (libs), as dylib and static libs as well as framework. Also I tried all different tutorials in the web. I am trying now more than a week. None worked.
    Either the Headers are not found or the linking fails. Seems like there is a bigger issue with Mojave 10.14, WT 5 + OpenCv3. Anybody who has it working in a real environment - not suggestions please!

    Here you can get the test case: http://files.lacunasolutions.com/various/qt-test.zip
    (I do it this way, because my first upload did not worked here.)

    @Sgaist: Following your hint I still get this:
    12:21:48: Running steps for project qt-test...
    12:21:48: Configuration unchanged, skipping qmake step.
    12:21:48: Starting: "/usr/bin/make" -j8
    /Applications/Extras/development/Qt/5.11.3/clang_64/bin/qmake -o Makefile qt-test.pro -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+=qml_debug
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.11 -Wl,-rpath,@executable_path/Frameworks -Wl,-rpath,/Applications/Extras/development/Qt/5.11.3/clang_64/lib -o qt-test.app/Contents/MacOS/qt-test main.o mainwindow.o camviewer.o moc_mainwindow.o -F/Applications/Extras/development/Qt/5.11.3/clang_64/lib -F/Users/ademmler/QtProjects/qt-test/Frameworks/ -framework opencv2 -framework QtWidgets -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
    Undefined symbols for architecture x86_64:
    "_AVCaptureSessionPresetMedium", referenced from:
    CvCaptureCAM::startCaptureDevice(int) in opencv2(cap_avfoundation.o)
    "_AVFileType3GPP", referenced from:
    CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(char const*, int, double, CvSize, int) in opencv2(cap_avfoundation.o)
    "_AVFileTypeAppleM4V", referenced from:
    CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(char const*, int, double, CvSize, int) in opencv2(cap_avfoundation.o)
    "_AVFileTypeMPEG4", referenced from:
    CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(char const*, int, double, CvSize, int) in opencv2(cap_avfoundation.o)
    "_AVFileTypeQuickTimeMovie", referenced from:
    CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(char const*, int, double, CvSize, int) in opencv2(cap_avfoundation.o)
    "_AVMediaTypeMuxed", referenced from:
    CvCaptureCAM::startCaptureDevice(int) in opencv2(cap_avfoundation.o)
    "_AVMediaTypeVideo", referenced from:
    CvCaptureCAM::startCaptureDevice(int) in opencv2(cap_avfoundation.o)
    CvCaptureFile::CvCaptureFile(char const*) in opencv2(cap_avfoundation.o)
    CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(char const*, int, double, CvSize, int) in opencv2(cap_avfoundation.o)
    "_AVVideoCodecH264", referenced from:
    CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(char const*, int, double, CvSize, int) in opencv2(cap_avfoundation.o)
    "_AVVideoCodecJPEG", referenced from:
    CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(char const*, int, double, CvSize, int) in opencv2(cap_avfoundation.o)
    "_AVVideoCodecKey", referenced from:
    CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(char const*, int, double, CvSize, int) in opencv2(cap_avfoundation.o)
    "_AVVideoHeightKey", referenced from:
    CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(char const*, int, double, CvSize, int) in opencv2(cap_avfoundation.o)
    "_AVVideoWidthKey", referenced from:
    CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(char const*, int, double, CvSize, int) in opencv2(cap_avfoundation.o)
    "_CFDataGetBytePtr", referenced from:
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CFRelease", referenced from:
    CvCaptureFile::retrieveFramePixelBuffer() in opencv2(cap_avfoundation.o)
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CGColorSpaceCreateDeviceRGB", referenced from:
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CGColorSpaceRelease", referenced from:
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CGDataProviderCopyData", referenced from:
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CGDataProviderCreateWithCFData", referenced from:
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CGDataProviderRelease", referenced from:
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CGImageCreate", referenced from:
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CGImageGetBytesPerRow", referenced from:
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CGImageGetDataProvider", referenced from:
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CGImageRelease", referenced from:
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CMSampleBufferGetImageBuffer", referenced from:
    -[CaptureDelegate captureOutput:didOutputSampleBuffer:fromConnection:] in opencv2(cap_avfoundation.o)
    CvCaptureFile::retrieveFramePixelBuffer() in opencv2(cap_avfoundation.o)
    "_CMSampleBufferInvalidate", referenced from:
    CvCaptureFile::retrieveFramePixelBuffer() in opencv2(cap_avfoundation.o)
    "_CMTimeMake", referenced from:
    CvCaptureCAM::startCaptureDevice(int) in opencv2(cap_avfoundation.o)
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CMVideoFormatDescriptionGetPresentationDimensions", referenced from:
    CvCaptureCAM::getProperty(int) const in opencv2(cap_avfoundation.o)
    "_CVBufferRelease", referenced from:
    -[CaptureDelegate captureOutput:didOutputSampleBuffer:fromConnection:] in opencv2(cap_avfoundation.o)
    -[CaptureDelegate updateImage] in opencv2(cap_avfoundation.o)
    CvCaptureFile::retrieveFramePixelBuffer() in opencv2(cap_avfoundation.o)
    "_CVBufferRetain", referenced from:
    -[CaptureDelegate captureOutput:didOutputSampleBuffer:fromConnection:] in opencv2(cap_avfoundation.o)
    -[CaptureDelegate updateImage] in opencv2(cap_avfoundation.o)
    CvCaptureFile::retrieveFramePixelBuffer() in opencv2(cap_avfoundation.o)
    "_CVPixelBufferCreateWithBytes", referenced from:
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CVPixelBufferGetBaseAddress", referenced from:
    -[CaptureDelegate updateImage] in opencv2(cap_avfoundation.o)
    CvCaptureFile::retrieveFramePixelBuffer() in opencv2(cap_avfoundation.o)
    "_CVPixelBufferGetBytesPerRow", referenced from:
    -[CaptureDelegate updateImage] in opencv2(cap_avfoundation.o)
    CvCaptureFile::retrieveFramePixelBuffer() in opencv2(cap_avfoundation.o)
    "_CVPixelBufferGetHeight", referenced from:
    -[CaptureDelegate updateImage] in opencv2(cap_avfoundation.o)
    CvCaptureFile::retrieveFramePixelBuffer() in opencv2(cap_avfoundation.o)
    "_CVPixelBufferGetWidth", referenced from:
    -[CaptureDelegate updateImage] in opencv2(cap_avfoundation.o)
    CvCaptureFile::retrieveFramePixelBuffer() in opencv2(cap_avfoundation.o)
    "_CVPixelBufferLockBaseAddress", referenced from:
    -[CaptureDelegate updateImage] in opencv2(cap_avfoundation.o)
    CvCaptureFile::retrieveFramePixelBuffer() in opencv2(cap_avfoundation.o)
    "_CVPixelBufferRelease", referenced from:
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "_CVPixelBufferUnlockBaseAddress", referenced from:
    -[CaptureDelegate updateImage] in opencv2(cap_avfoundation.o)
    CvCaptureFile::retrieveFramePixelBuffer() in opencv2(cap_avfoundation.o)
    "_NSDefaultRunLoopMode", referenced from:
    CvCaptureCAM::startCaptureDevice(int) in opencv2(cap_avfoundation.o)
    CvCaptureCAM::grabFrame() in opencv2(cap_avfoundation.o)
    CvCaptureCAM::grabFrame(double) in opencv2(cap_avfoundation.o)
    CvCaptureCAM::setWidthHeight() in opencv2(cap_avfoundation.o)
    "_NSLog", referenced from:
    CvCaptureFile::CvCaptureFile(char const*) in opencv2(cap_avfoundation.o)
    CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(char const*, int, double, CvSize, int) in opencv2(cap_avfoundation.o)
    CvVideoWriter_AVFoundation::writeFrame(_IplImage const*) in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_AVAssetReader", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_AVAssetReaderTrackOutput", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_AVAssetWriter", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_AVAssetWriterInput", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_AVAssetWriterInputPixelBufferAdaptor", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_AVCaptureDevice", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_AVCaptureDeviceInput", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_AVCaptureSession", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_AVCaptureVideoDataOutput", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_AVURLAsset", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_NSAutoreleasePool", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_NSData", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_NSDate", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_NSDictionary", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_NSNumber", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_NSObject", referenced from:
    OBJC_CLASS$_CaptureDelegate in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_NSRunLoop", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_NSString", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_CLASS$_NSURL", referenced from:
    objc-class-ref in opencv2(cap_avfoundation.o)
    "OBJC_METACLASS$_NSObject", referenced from:
    OBJC_METACLASS$_CaptureDelegate in opencv2(cap_avfoundation.o)
    "___CFConstantStringClassReference", referenced from:
    CFString in opencv2(cap_avfoundation.o)
    CFString in opencv2(cap_avfoundation.o)
    CFString in opencv2(cap_avfoundation.o)
    CFString in opencv2(cap_avfoundation.o)
    CFString in opencv2(cap_avfoundation.o)
    CFString in opencv2(cap_avfoundation.o)
    CFString in opencv2(cap_avfoundation.o)
    ...
    "__objc_empty_cache", referenced from:
    OBJC_CLASS$_CaptureDelegate in opencv2(cap_avfoundation.o)
    OBJC_METACLASS$_CaptureDelegate in opencv2(cap_avfoundation.o)
    "_kCMTimeZero", referenced from:
    CvVideoWriter_AVFoundation::CvVideoWriter_AVFoundation(char const*, int, double, CvSize, int) in opencv2(cap_avfoundation.o)
    "_kCVPixelBufferHeightKey", referenced from:
    CvCaptureCAM::startCaptureDevice(int) in opencv2(cap_avfoundation.o)
    CvCaptureCAM::setWidthHeight() in opencv2(cap_avfoundation.o)
    "_kCVPixelBufferPixelFormatTypeKey", referenced from:
    CvCaptureCAM::startCaptureDevice(int) in opencv2(cap_avfoundation.o)
    CvCaptureCAM::setWidthHeight() in opencv2(cap_avfoundation.o)
    CvCaptureFile::CvCaptureFile(char const*) in opencv2(cap_avfoundation.o)
    "_kCVPixelBufferWidthKey", referenced from:
    CvCaptureCAM::startCaptureDevice(int) in opencv2(cap_avfoundation.o)
    CvCaptureCAM::setWidthHeight() in opencv2(cap_avfoundation.o)
    "_objc_msgSend", referenced from:
    CvCaptureCAM::startCaptureDevice(int) in opencv2(cap_avfoundation.o)
    CvCaptureCAM::~CvCaptureCAM() in opencv2(cap_avfoundation.o)
    CvCaptureCAM::stopCaptureDevice() in opencv2(cap_avfoundation.o)
    CvCaptureCAM::~CvCaptureCAM() in opencv2(cap_avfoundation.o)
    CvCaptureCAM::~CvCaptureCAM() in opencv2(cap_avfoundation.o)
    CvCaptureCAM::grabFrame() in opencv2(cap_avfoundation.o)
    CvCaptureCAM::grabFrame(double) in opencv2(cap_avfoundation.o)
    ...
    "_objc_msgSendSuper2", referenced from:
    -[CaptureDelegate init] in opencv2(cap_avfoundation.o)
    -[CaptureDelegate dealloc] in opencv2(cap_avfoundation.o)
    "_objc_msgSend_stret", referenced from:
    CvCaptureFile::CvCaptureFile(char const*) in opencv2(cap_avfoundation.o)
    "_objc_sync_enter", referenced from:
    -[CaptureDelegate captureOutput:didOutputSampleBuffer:fromConnection:] in opencv2(cap_avfoundation.o)
    -[CaptureDelegate updateImage] in opencv2(cap_avfoundation.o)
    "_objc_sync_exit", referenced from:
    -[CaptureDelegate captureOutput:didOutputSampleBuffer:fromConnection:] in opencv2(cap_avfoundation.o)
    -[CaptureDelegate updateImage] in opencv2(cap_avfoundation.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [qt-test.app/Contents/MacOS/qt-test] Error 1
    12:21:51: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project qt-test (kit: Qt 5.11.3 clang 64bit)
    When executing step "Make"
    12:21:51: Elapsed time: 00:03.


  • Lifetime Qt Champion

    Since these are frameworks from macOS, add them to the LIBS variable.

    LIBS += -framework CoreFoundation -framework AVFoundation



  • @SGaist thx for your idea.
    I still have this error: /Users/ademmler/QtProjects/qt-test/mainwindow.h:6: error: 'opencv2/core.hpp' file not found
    #include <opencv2/core.hpp>
    ^~~~~~~~~~~~~~~~~~


  • Lifetime Qt Champion

    Did you change anything else your .pro file ?



  • A possible Solution:

    after readings tons of threads I found one explaining how to compile the actual OpenCV 3.8 a single lib (opencv_world.dylib).
    (Sorry I lost the link from which I got the idea.) Than I included this into my pro file. After this I did clean, than I had to repast the whole code into QTCreator.
    After this - and only then - the code got recognized correctly and the calcHist function was found.

    Thx to everybody for helping.

    My actual *.pro file:
    #-------------------------------------------------

    Project created by QtCreator 2016-06-07T18:10:12

    #-------------------------------------------------

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    CONFIG += sdk_no_version_check
    CONFIG -= app

    #QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14

    TARGET = CameraBox
    TEMPLATE = app

    DEFINES += QT_DEPRECATED_WARNINGS
    CONFIG += c++11

    SOURCES += main.cpp
    mainwindow.cpp
    camviewer.cpp
    mywidget.cpp

    HEADERS += mainwindow.h
    camviewer.h
    mywidget.h

    FORMS += mainwindow.ui
    mywidget.ui

    INCLUDEPATH += $$PWD/.
    DEPENDPATH += $$PWD/.

    INCLUDEPATH += /usr/local/include
    LIBS += -L/usr/local/lib
    -lopencv_world

    debug: DESTDIR = $$PWD/debug/mac
    release: DESTDIR = $$PWD/release/mac

    OBJECTS_DIR = $$DESTDIR/tmp
    MOC_DIR = $$DESTDIR/tmp
    RCC_DIR = $$DESTDIR/tmp
    UI_DIR = $$DESTDIR/tmp


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.