C++ Eclipse Opencv Mac Symbol(s) Not Found For Architecture X86_64 Clang: Error:
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_067_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.
Apr 8, 2017 - How to avoid duplicate symbols when compiling The error: duplicate symbol for architecture x86_64 will be prompted if the following files are. @SGaist Hi, thx for your response. Yes you are right. The symlink was needed to get QT to recognize the Header files. Red wine for mac. But still I can't compile. Here is the ls output from my test case.
-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. 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.
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. 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: (I do it this way, because my first upload did not worked here.): Following your hint I still get this: 12:21:48: Running steps for project qt-test. 12:21:48: Configuration unchanged, skipping qmake step. 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.