When to generate an executable with xcode, I have 3 Linking errors. I used Irrlicht 1.9 that I compile myself this morning.
I would like to say that the file CIrrDeviceOSX.mm is an objective-c file that can be found here :
https://github.com/zaki/irrlicht/blob/master/source/Irrlicht/CIrrDeviceOSX.h
https://github.com/zaki/irrlicht/blob/master/source/Irrlicht/CIrrDeviceOSX.mm
I think that the error is inside "std::map KeyCodes;" in CIrrDeviceOSX.h and used in CIrrDeviceOSX.mm
I dont know if the problem is that the file is in objective-c and the signature of the methods is different or that there are difference in version of the C++ (c++11 or ???).
Ld bin/Debug/minetest normal x86_64
cd /Users/bluholm/Desktop/minetest-release/minetest
export MACOSX_DEPLOYMENT_TARGET=10.12
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -L/Users/bluholm/Desktop/minetest-release/minetest/bin/Debug -F/Users/bluholm/Desktop/minetest-release/minetest/bin/Debug -filelist /Users/bluholm/Desktop/minetest-release/minetest-osx/src/minetest.build/Debug/minetest.build/Objects-normal/x86_64/minetest.LinkFileList -mmacosx-version-min=10.12 -Xlinker -object_path_lto -Xlinker /Users/bluholm/Desktop/minetest-release/minetest-osx/src/minetest.build/Debug/minetest.build/Objects-normal/x86_64/minetest_lto.o -Xlinker -no_deduplicate -lc++ -pagezero_size 10000 -image_base 100000000 -Wl,-search_paths_first -Wl,-headerpad_max_install_names /usr/lib/libz.dylib /usr/local/Cellar/irrlicht/1.9/lib/libIrrlicht.a -framework OpenGL -framework OpenAL /usr/local/lib/libvorbisfile.dylib /usr/local/lib/libvorbis.dylib /usr/local/lib/libogg.dylib /usr/lib/libsqlite3.dylib /usr/local/lib/libluajit-5.1.dylib /Users/bluholm/Desktop/minetest-release/minetest-osx/src/gmp/Debug/libgmp.a /Users/bluholm/Desktop/minetest-release/minetest-osx/src/jsoncpp/json/Debug/libjsoncpp.a -framework CoreFoundation -lpthread /usr/lib/libiconv.dylib -framework Carbon -framework Cocoa -framework IOKit /usr/lib/libiconv.dylib /usr/lib/libcurl.dylib /usr/local/lib/libfreetype.dylib /Users/bluholm/Desktop/minetest-release/minetest-osx/src/cguittfont/Debug/libcguittfont.a /usr/lib/libcurses.dylib /usr/lib/libform.dylib /usr/local/lib/libhiredis.dylib -framework Carbon -framework Cocoa -framework IOKit /usr/lib/libcurl.dylib /usr/lib/libcurses.dylib /usr/lib/libform.dylib /usr/local/lib/libhiredis.dylib /usr/lib/libz.dylib /usr/local/Cellar/irrlicht/1.9/lib/libIrrlicht.a /usr/local/lib/libfreetype.dylib -Xlinker -dependency_info -Xlinker /Users/bluholm/Desktop/minetest-release/minetest-osx/src/minetest.build/Debug/minetest.build/Objects-normal/x86_64/minetest_dependency_info.dat -o /Users/bluholm/Desktop/minetest-release/minetest/bin/Debug/minetest
Undefined symbols for architecture x86_64:
"std::_Rb_tree_decrement(std::_Rb_tree_node_base*)", referenced from:
std::_Rb_tree_iterator >::operator--() in libIrrlicht.a(CIrrDeviceOSX.o)
"std::_Rb_tree_increment(std::_Rb_tree_node_base*)", referenced from:
std::_Rb_tree_iterator >::operator++() in libIrrlicht.a(CIrrDeviceOSX.o)
"std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from:
std::_Rb_tree, std::_Select1st >, std::less, std::allocator > >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair const&) in libIrrlicht.a(CIrrDeviceOSX.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Try to created a new project in XCode with the sources and changed the C++ Standard Library from the default libc++ to libstdc++
Related
I'm working on my project which uses mongoDB. I've installed mongocxx according to the official guide and it works when I'm compiling the code from command line. Now I'd like to use it in my Qt project, I've added all necessary libraries in .pro file but I can't compile my code because of linker error. The code is the simplest:
#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>
void connectToMongo() {
mongocxx::instance abc{};
}
.pro:
CONFIG += c++11
QMAKE_CXXFLAGS += -I/usr/local/include/mongocxx/v_noabi -I/usr/local/include/libmongoc-1.0 \
-I/usr/local/include/bsoncxx/v_noabi -I/usr/local/include/libbson-1.0 \
-L/usr/local/lib -lmongocxx -lbsoncxx
SOURCES += main.cpp
...
But, unfortunately, there is a linker's error:
Undefined symbols for architecture x86_64:
"mongocxx::v_noabi::instance::instance()", referenced from:
connectToMongo() in main.o
"mongocxx::v_noabi::instance::~instance()", referenced from:
connectToMongo() in main.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: *** [hw.app/Contents/MacOS/hw] Error 1
18:38:01: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project hw (kit: Desktop Qt 5.8.0 clang 64bit)
When executing step "Make"
the make's string:
Starting: "/usr/bin/make"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.12 -I/usr/local/include/mongocxx/v_noabi -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/bsoncxx/v_noabi -I/usr/local/include/libbson-1.0 -L/usr/local/lib -lmongocxx -lbsoncxx -g -std=gnu++1z -Wall -W -fPIC -DQT_QML_DEBUG -DQT_WEBENGINEWIDGETS_LIB -DQT_WEBENGINECORE_LIB -DQT_QUICKCONTROLS2_LIB -DQT_QUICK_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_WEBCHANNEL_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_POSITIONING_LIB -DQT_CORE_LIB -I../hw -I. -I../Qt/5.8/clang_64/lib/QtWebEngineWidgets.framework/Headers -I../Qt/5.8/clang_64/lib/QtWebEngineCore.framework/Headers -I../Qt/5.8/clang_64/lib/QtQuickControls2.framework/Headers -I../Qt/5.8/clang_64/lib/QtQuick.framework/Headers -I../Qt/5.8/clang_64/lib/QtPrintSupport.framework/Headers -I../Qt/5.8/clang_64/lib/QtWidgets.framework/Headers -I../Qt/5.8/clang_64/lib/QtGui.framework/Headers -I../Qt/5.8/clang_64/lib/QtWebChannel.framework/Headers -I../Qt/5.8/clang_64/lib/QtQml.framework/Headers -I../Qt/5.8/clang_64/lib/QtNetwork.framework/Headers -I../Qt/5.8/clang_64/lib/QtPositioning.framework/Headers -I../Qt/5.8/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AGL.framework/Headers -I../Qt/5.8/clang_64/mkspecs/macx-clang -F/Users/alexey/Qt/5.8/clang_64/lib -o main.o ../hw/main.cpp
clang: warning: -lmongocxx: 'linker' input unused
clang: warning: -lbsoncxx: 'linker' input unused
clang: warning: argument unused during compilation: '-L/usr/local/lib'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -stdlib=libc++ -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.12 -Wl,-rpath,/Users/alexey/Qt/5.8/clang_64/lib -o hw.app/Contents/MacOS/hw main.o qrc_qml.o moc_filldatacollections.o -F/Users/alexey/Qt/5.8/clang_64/lib -framework QtWebEngineWidgets -framework QtWebEngineCore -framework QtQuick -framework QtQml -framework QtNetwork -framework QtCore -framework DiskArbitration -framework IOKit -framework QtGui -framework QtWebChannel -framework QtPositioning -framework QtPrintSupport -framework QtWidgets -framework QtQuickControls2 -framework OpenGL -framework AGL
I've already found a decision for such problem in different topics, e.g. http://widequestion.com/question/msgasserted-linker-errors-on-mongo-c-drivers-on-macosx-10-10-3-yosemite/
but it'n't working in my case. My OS X is 10.11.
Help me, please, to resolve this problem.
clang: warning: -lmongocxx: 'linker' input unused
clang: warning: -lbsoncxx: 'linker' input unused
clang: warning: argument unused during compilation: '-L/usr/local/lib'
You seem to have set your linker flags as cxxflags so they were applied building main.o (when they were unused) and not applied during linking to build the executable.
I haven't worked with Qt, but a quick search suggests maybe those should have been set on LIBS. See docs for declaring other libraries.
I've been looking for a proper HTTP parser in C++ and today I found that Poco has support for both parsing HTTP requests, setting up a server and also setting up a HTTPS server along with other cool features and I'm eager to start using it.
I've got a problem with compiling a small example though, the project is setup as a stdc++11 project, I've set the header and library search path to /usr/local/include and /usr/local/lib and have linked the libraries themselves in the Other Linker Flags in this order "-lPocoNet -lPocoUtil -lPocoFoundation -lPocoXML -lPocoJSON" the order of which doesn't seem to matter.
The code itself doesn't throw any errors within XCode, it's just when I try to compile it I get these reference errors, I've fixed 38 others of them by adding the libraries to the Other Linker Flags option but these two errors won't go away.
The error I'm getting is the following
Ld /Users/zezioen/Library/Developer/Xcode/DerivedData/NitroServer-gpnzdaqmezqcauegsmrabobsxotk/Build/Products/Debug/NitroServer normal x86_64
cd /Users/zezioen/stack/Projecten/CPP/NitroServer
export MACOSX_DEPLOYMENT_TARGET=10.11
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -L/Users/zezioen/Library/Developer/Xcode/DerivedData/NitroServer-gpnzdaqmezqcauegsmrabobsxotk/Build/Products/Debug -L/Users/zezioen/stack/Projecten/CPP/NitroServer/lib -L/usr/local/lib -F/Users/zezioen/Library/Developer/Xcode/DerivedData/NitroServer-gpnzdaqmezqcauegsmrabobsxotk/Build/Products/Debug -F/Users/zezioen/stack/Projecten/CPP/NitroServer/lib -filelist /Users/zezioen/Library/Developer/Xcode/DerivedData/NitroServer-gpnzdaqmezqcauegsmrabobsxotk/Build/Intermediates/NitroServer.build/Debug/NitroServer.build/Objects-normal/x86_64/NitroServer.LinkFileList -mmacosx-version-min=10.11 -Xlinker -no_deduplicate -lPocoNet -lPocoUtil -lPocoFoundation -lPocoXML -lPocoJSON -stdlib=libstdc++ -Xlinker -dependency_info -Xlinker /Users/zezioen/Library/Developer/Xcode/DerivedData/NitroServer-gpnzdaqmezqcauegsmrabobsxotk/Build/Intermediates/NitroServer.build/Debug/NitroServer.build/Objects-normal/x86_64/NitroServer_dependency_info.dat -o /Users/zezioen/Library/Developer/Xcode/DerivedData/NitroServer-gpnzdaqmezqcauegsmrabobsxotk/Build/Products/Debug/NitroServer
Undefined symbols for architecture x86_64:
"Poco::Net::HTTPMessage::setContentType(std::string const&)", referenced from:
MyRequestHandler::handleRequest(Poco::Net::HTTPServerRequest&, Poco::Net::HTTPServerResponse&) in main.o
"Poco::Util::Application::handleOption(std::string const&, std::string const&)", referenced from:
vtable for MyServerApp in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What do I have to do in order to get the project to build?
Resolved here - POCO is linked with libc++, application was linking with libstdc++.
I'm trying to build my C++ application with Thrift and it fails. I don't understand the error.
Ld ./build/Debug/neptune.app/Contents/MacOS/neptune normal i386
cd /Users/orsa/home/projects/neptune/xcode
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -L/Users/orsa/home/projects/neptune/xcode/build/Debug -L/Users/orsa/home/projects/neptune/xcode/../lib -L/usr/local/lib -F/Users/orsa/home/projects/neptune/xcode/build/Debug -F../blocks/Awesomium/build/lib/macosx -filelist /Users/orsa/home/projects/neptune/xcode/./build/neptune.build/Debug/neptune.build/Objects-normal/i386/neptune.LinkFileList -mmacosx-version-min=10.7 -dead_strip ../../../software/Cinder_Github/lib/libcinder_d.a ../blocks/Cairo/lib/macosx/libcairo.a ../blocks/Cairo/lib/macosx/libpixman-1.a ../blocks/Cairo/lib/macosx/libpng14.a ../blocks/OpenCV/lib/macosx/libopencv_calib3d.a ../blocks/OpenCV/lib/macosx/libopencv_contrib.a ../blocks/OpenCV/lib/macosx/libopencv_core.a ../blocks/OpenCV/lib/macosx/libopencv_features2d.a ../blocks/OpenCV/lib/macosx/libopencv_flann.a ../blocks/OpenCV/lib/macosx/libopencv_gpu.a ../blocks/OpenCV/lib/macosx/libopencv_imgproc.a ../blocks/OpenCV/lib/macosx/libopencv_legacy.a ../blocks/OpenCV/lib/macosx/libopencv_ml.a ../blocks/OpenCV/lib/macosx/libopencv_nonfree.a ../blocks/OpenCV/lib/macosx/libopencv_objdetect.a ../blocks/OpenCV/lib/macosx/libopencv_photo.a ../blocks/OpenCV/lib/macosx/libopencv_stitching.a ../blocks/OpenCV/lib/macosx/libopencv_ts.a ../blocks/OpenCV/lib/macosx/libopencv_video.a ../blocks/OpenCV/lib/macosx/libopencv_videostab.a ../blocks/Qhull/libs/macosx/libqhullcpp.a ../blocks/Qhull/libs/macosx/libqhullstatic.a -stdlib=libc++ -lthrift -levent -llibssh2 -framework Cocoa -framework OpenGL -framework CoreVideo -framework QTKit -framework Accelerate -framework AudioToolbox -framework AudioUnit -framework CoreAudio -framework Awesomium -lcrypto -lz -o /Users/orsa/home/projects/neptune/xcode/./build/Debug/neptune.app/Contents/MacOS/neptune
Undefined symbols for architecture i386:
"vtable for apache::thrift::server::TNonblockingServer", referenced from:
apache::thrift::server::TNonblockingServer::TNonblockingServer<apache::thrift::TProcessor>(boost::shared_ptr<apache::thrift::TProcessor> const&, boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> const&, int, boost::shared_ptr<apache::thrift::concurrency::ThreadManager> const&, boost::enable_if<boost::is_convertible<apache::thrift::TProcessor*, apache::thrift::TProcessor*>::type, void*>::type) in neptuneApp-11ADA2EE725CBF5F.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"apache::thrift::server::TNonblockingServer::setThreadManager(boost::shared_ptr<apache::thrift::concurrency::ThreadManager>)", referenced from:
apache::thrift::server::TNonblockingServer::TNonblockingServer<apache::thrift::TProcessor>(boost::shared_ptr<apache::thrift::TProcessor> const&, boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> const&, int, boost::shared_ptr<apache::thrift::concurrency::ThreadManager> const&, boost::enable_if<boost::is_convertible<apache::thrift::TProcessor*, apache::thrift::TProcessor*>::type, void*>::type) in neptuneApp-11ADA2EE725CBF5F.o
"apache::thrift::server::TNonblockingServer::serve()", referenced from:
NeptuneBrowserApp::startThriftServer() in neptuneApp-11ADA2EE725CBF5F.o
"apache::thrift::server::TNonblockingServer::~TNonblockingServer()", referenced from:
NeptuneBrowserApp::startThriftServer() in neptuneApp-11ADA2EE725CBF5F.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Not the real answer, but I'd suggest to post that on the mailing list.
I’m building an application on Mac OSX 10.8 (Mountain Lion) and I’m getting a linkage error relating to a Boost library (serialisation.a). I’m using other Boost binaries in the same project and they’re not throwing up any problems, so I’m pretty confident that I’ve built the libraries correctly (I elected to build the entire suite of libraries for the Darwin toolset). For the same reason, I’m reasonably confident that my linker path is set correctly. I know there aren’t many Mac developers on this list, but I’m wondering if anybody can offer any suggestions. The project is handled by XCode 4.5.2 and uses the GCC 4.2 compiler. The following is the output from the build (I’ve only included the first error – all of the rest are variations on a theme and all refer to Boost::archive or Boost::serialisation (both of which are contained within the Boost serialisation.a static library file).
Ld /Users/tim/Library/Developer/Xcode/DerivedData/SurfaceReader-fwryryuvfvwihnglkuymbbjtxpac/Build/Products/Debug/SurfaceReader.app/Contents/MacOS/SurfaceReader normal x86_64
cd /Users/tim/Developer/SurfaceReader
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/Applications/Xcode.app/Contents/Developer/usr/bin/llvm-g++-4.2 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/tim/Library/Developer/Xcode/DerivedData/SurfaceReader-fwryryuvfvwihnglkuymbbjtxpac/Build/Products/Debug -L/users/tim/developer/libraries/boost_1_50_0/lib -L/users/tim/developer/libraries/cryptopp561 -F/Users/tim/Library/Developer/Xcode/DerivedData/SurfaceReader-fwryryuvfvwihnglkuymbbjtxpac/Build/Products/Debug -filelist /Users/tim/Library/Developer/Xcode/DerivedData/SurfaceReader-fwryryuvfvwihnglkuymbbjtxpac/Build/Intermediates/SurfaceReader.build/Debug/SurfaceReader.build/Objects-normal/x86_64/SurfaceReader.LinkFileList -mmacosx-version-min=10.8 -L/Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_osx_cocoau_xrc-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_osx_cocoau_webview-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_osx_cocoau_qa-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_baseu_net-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_osx_cocoau_html-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_osx_cocoau_adv-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_osx_cocoau_core-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_baseu_xml-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_baseu-2.9.a -framework WebKit -lexpat -lwxregexu-2.9 -lwxtiff-2.9 -lwxjpeg-2.9 -lwxpng-2.9 -lz -lpthread -liconv -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -framework CoreMIDI -framework CoreAudio -framework Cocoa -lboost_filesystem -lboost_iostreams -lboost_serialization -lboost_system -lcryptopp -o /Users/tim/Library/Developer/Xcode/DerivedData/SurfaceReader-fwryryuvfvwihnglkuymbbjtxpac/Build/Products/Debug/SurfaceReader.app/Contents/MacOS/SurfaceReader
Undefined symbols for architecture x86_64:
"boost::archive::basic_xml_iarchive<boost::archive::xml_wiarchive>::load_start(char const*)", referenced from:
void boost::archive::basic_xml_iarchive<boost::archive::xml_wiarchive>::load_override<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >(boost::serialization::nvp<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > const&, int)in SurfaceFrame.o
Changing Apple LLVM Standard Compiler 4.2 - Language / C++ Standard Library setting from libc++ (LLVM) to libstdc++ (GNU) solved the same case for me.
I'm looking at opencv highgui samples (like connectedcomponents.cpp) and trying to get used to adding GUI elements. Currently I'm trying to add a button:
void on_button(int, void*){
cout << "click" << end;
}
//in main()
createButton("test",on_button);
but I get a link error:
g++ -c -pipe -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_CORE_LIB -I../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/macx-g++ -I. -I../../../QtSDK/Desktop/Qt/474/gcc/lib/QtCore.framework/Versions/4/Headers -I../../../QtSDK/Desktop/Qt/474/gcc/include/QtCore -I../../../QtSDK/Desktop/Qt/474/gcc/include -I/opt/local/include -I../../../QtSDK/Desktop/Qt/474/gcc/include -I. -F/Users/george/QtSDK/Desktop/Qt/474/gcc/lib -o main.o main.cpp
g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o CVConnectedComponent main.o -F/Users/george/QtSDK/Desktop/Qt/474/gcc/lib -L/Users/george/QtSDK/Desktop/Qt/474/gcc/lib /opt/local/lib/libopencv_core.dylib /opt/local/lib/libopencv_contrib.dylib /opt/local/lib/libopencv_highgui.dylib /opt/local/lib/libopencv_objdetect.dylib /opt/local/lib/libopencv_imgproc.dylib /opt/local/lib/libopencv_features2d.dylib /opt/local/lib/libopencv_video.dylib -framework QtCore -F/Users/george/Documents/Qt/CVConnectedComponent/../../../QtSDK/Desktop/Qt/474/gcc/lib/
Undefined symbols:
"cv::createButton(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, void (*)(int, void*), void*, int, bool)", referenced from:
_main in main.o
make: Leaving directory `/Users/george/Documents/Qt/CVConnectedComponent'
ld: symbol(s) not found
As far as I can understand I'm not linking against the QtCore library properly.
I've this:
mac: LIBS += -framework QtCore
and this:
mac: LIBS += -F$$PWD/../../../QtSDK/Desktop/Qt/474/gcc/lib/ -framework QtCore
INCLUDEPATH += $$PWD/../../../QtSDK/Desktop/Qt/474/gcc/include
DEPENDPATH += $$PWD/../../../QtSDK/Desktop/Qt/474/gcc/include
In the .pro file of the Qt project, but with no luck.
I'm using OpenCV 2.4.1 with Qt 4.7.4 on osx 10.6.8.
What's the correct way to link to QtCore in Qt Creator to use createButton in OpenCV ?
I've reinstalled OpenCV, this time with Qt support and the code worked.
Still it's worth remembering that buttons will go into the Control Panel by default, as I found out by reading some documentation: