I am working on an OpenCV-based project on Xcode 5.02, OS X 10.9.
My OpenCV was installed using homebrew.
I get the following error
Undefined symbols for architecture x86_64:
"cv::namedWindow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)"
I have added Header Search Paths /usr/local/include nonrecursive and /usr/local/include/opencv2 nonrecursive;
I have added Library Search Paths /usr/local/lib;
I have added all .dylib file under /usr/local/Cellar/opencv/2.4.3/lib to the project.
From what I can see, you are trying to run an Objective-C++ project, right? I presume that because cv::nameWindow is a c++ function of OpenCV.
You can have a look on this question, where I had a similar issue and solved it configuring the project properly.
This error means your XCode project is not finding the cv::namedWindow function. Are u sure OpenCV is properly installed in your PC? Can you run the C++ opencv functions from a standard c++ project? If so, the problem is just about your project configuration.
Related
I know there are tons of questions regarding this issue, but i didn't come up with solution.
We have in my project (react-native) a static library: let's call it externalLib_v1.1r.a that we added manually to my project. It always worked fine. It's a security library and we have no access to the source code.
With the new version of Flipper, that comes with latest versions of react-native, i have the following issue when building with Xcode:
duplicate symbol 'fileExists(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)' in:
/Users/myuser/project/myproject/ios/externalLib_v1.1r.a(utility.o)
/Users/myuser/Library/Developer/Xcode/DerivedData/proj-duwrxsmkbkccvdfykaajqslcqijq/Build/Products/Debug-iphonesimulator/Flipper/libFlipper.a(ConnectionContextStore.o)
ld: 1 duplicate symbol for architecture x86_64
There are 2 methods (1 inside externalLib_v1.1r.a and 1 inside ConnectionContextStore.cpp (Flipper)) with the same name.
If i manually rename the fileExists method inside the Flipper Pod it all works...
Is there a way to avoid this workaround?
Note: I have the -ObjC flag in "Other Linker Flags" of my project.
I am using std::experimental::filesystem with Xcode 9.0 beta. The compiler phase completes OK but the linker complains of undefined symbols:
std::experimental::filesystem::v1::path::__filename() const
std::experimental::filesystem::v1::path::__filename() const
std::experimental::filesystem::v1::path::__stem() const
std::experimental::filesystem::v1::__status(std::experimental::filesystem::v1::path const&, std::__1::error_code*)
I am also using std::experimental::filesystem::canonical(), but the linker isn't complaining about that being missing.
How can I configure the project to include these missing references?
UPDATE:
I have been experimenting with a simpler program. If I just use canonical() then the linker complains that it is missing.
I can use std::experimental::optional - everything compiles, links and runs OK. But 'optional' is a template and so probably doesn't involve a library.
Are you compiling with any -std= option ("C++ Language Dialect" option in Xcode)?
I'm building a Unity project for an iOS8 simulator. Moving this for Xcode 6 GM for the simulator has resulted in this linker error. Not sure if I'm missing something in the build or something is broken. Any suggestions? The full error is:
Undefined symbols for architecture i386:
"_clock$UNIX2003", referenced from:
_substanceHandleSwitchHard in libiPhone-lib.a(apihandle.o)
_mainRenderProcess in libiPhone-lib.a(mainrenderprocess.o)
ld: symbol(s) not found for architecture i386
Exit with code 1
Add the following at the end of main.mm.
#include <time.h>
extern "C"
{
clock_t
clock$UNIX2003(void)
{
return clock();
}
}
clock$UNIX2003 is a symbol that is provided by OS X and is not part of the iOS Simulator runtime. iOS is always conformant and thus does not have legacy (non $UNIX2003) variants of functions (which are provided for binary compatibility with code built against older versions of the OS X SDK).
The common cause of the issue you are seeing is that you have an object file or archive (libsomething.a) that was built against the OS X SDK and are trying to link it into your iOS Simulator executable. That is not supported as the two platforms are not binary compatible at that layer.
You need to rebuild your library (the libsomething.a) against the iOS Simulator SDK.
I make a build for iPhone for the first time and got a problem.
I already checked a lot of posts and didnt find answer.
When i make a build on device a get:
Undefined symbols for architecture armv7:
"RegisterAllStrippedInternalCalls()", referenced from:
RegisterAllInternalCalls() in libiPhone-lib.a(MonoICallRegistration.o)
"RegisterAllClasses()", referenced from:
InitializeEngineNoGraphics() in libiPhone-lib.a(SaveAndLoadHelper.o)
"RegisterMonoModules()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
On simulator ok.
libiPhone-lib.a added to link libraries.
Can somebody tell what it is? Please
Your unity version is not compatible, just download the latest version of unity which I believe is 4.3.1 and try recompiling. Here is the link if you need it. http://unity3d.com/unity/download/download-mac
The new version is compatible with armv7.
ok if anyone else is experiencing the same problem here's a way out:
those 3 methods mentioned are declared in the RegisterMonoModules.cpp in the Libraries folder, usually. so take that cpp file and add it to your target's Build Phases > Compile Sources
then if you have additional SDK's integrated that are not added to the 'Compile Sources' the new build will throw some other errors. just make sure to add the wrapper .mm files from the sdk's to your Compile Sources. Usually one .mm file per sdk. (e.g. for unity facebook sdk it's FbUnityInterface.mm file)
hope this helps
I'm trying to build the basemap toolkit, from source, for matplotlib to run on my MacBook Pro under OS X 10.8. The C and C++ compiler are those included with the latest Xcode package. The package includes the geos-3.3.3 package which needs to be built separately and installed before the main basemap python package is built. When I do this, using the supplied Makefile, I get the following error when the makefile attempts to build the libgeos.dylib library:
Undefined symbols for architecture x86_64:
"std::auto_ptr<geos::geom::Envelope>::auto_ptr(std::auto_ptr_ref<geos::geom::Envelope>)", referenced from:
virtual thunk to geos::geom::GeometryCollection::computeEnvelopeInternal() constin libgeom.a(GeometryCollection.o)
"__ZNSt8auto_ptrIN4geos4geom8EnvelopeEEcvSt12auto_ptr_refIT_EIS2_EEv", referenced from:
virtual thunk to geos::geom::GeometryCollection::computeEnvelopeInternal() constin libgeom.a(GeometryCollection.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
On a Fedora 17 machine, with gcc 4.7, this library builds successfully so there is obviously something going on with the Mac compiler/linker. However, I have no idea how to decode this message. What, for instance, is a "virtual thunk"? Any insight on how I can compile and build this on the Mac?
I used a different compiler and the problem went away. Try:
make CXX=c++
Worked for me. OSX 10.8.3, XCode 4.6.1.