I'm trying to link the Box2D C++ library to my Xcode 4.4 project through the libBox.2.1.0.dylib file. Here's what i did:
Went to the "Targets", selected my application, and added my .dylib file in the "Link Binary With Libraries" section
Created a new "Copy Files" build phase and set it to "Executables" (so the .dylib file is right next to the internal executable in the .app bundle)
Successfully compiled my project with no errors whatsoever
Ran project and got the following runtime-error:
dyld: Library not loaded: libBox2D.2.1.0.dylib
Referenced from: /Users/****/Documents/Xcode Projects/ProjectName/DerivedData/ProjectName/Build/Products/Debug/ProjectName.app/Contents/MacOS/ProjectName
Reason: image not found
I followed all the steps from this link here, but I still get the runtime-error for some reason. I am I missing something important in my setup?
Related
I update Xcode to 7.0. Then I build the project then get errors below.I have try the solution the add the lib "libsqlite3.dylib" and "libz.dylib" to "Link Binary With Libraries" manually. But it doesn't work.
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib/libsqlite3.dylib (No such file or directory)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib/libz.dylib (No such file or directory)
You need to remove all references to .framework and .dylib files under Xcode 7. libcocos2d is a static library and therefore there is no link phase. You can only link in .framework and .dylib files in your game's project file.
I'm getting the following two errors via xcode:
Warning: no rule to process file '$(PROJECT_DIR)/SQLite Toolbox/en.lproj/MainWindowController.m' of type file for architecture x86_64
Followed by:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_MainWindowController", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
Previously my project was building just fine, but I attempted to do some localization. I had my MainWindowController.xib highlighted and choose the localize option.
After that, the project stopped compiling. It looks to me that for some reason XCode is refusing to compile my MainWindowController.m, but i'm not sure how to go about fixing that. (I have confirmed it does exist in the Build Phase Compile Source steps.
Any ideas on how I could fix this?
That sounds as if you inadvertently have localized the "MainWindowController.m" file.
The following steps worked in my test project to fix that situation:
Remove "MainWindowController.m" from your project (using the "Remove Reference" option!)
In the Finder, move "MainWindowController.m" from the "en.lproj" folder back to the main folder.
Drag "MainWindowController.m" onto the Xcode project to add it again.
I am too much of this Static Libary thing in Xcode 4.X
Following are the steps that I usually do..
1)For making a static libary , I open Xcode , new , static libary , and then by adding some classes in the project .. then build phases ->copy headers -> add all headers here one by one,and then i build up the project
when run on ios simulator -> static libary does not created ..(red color)
when run on ios device - > static library gets created..
2) for using the library..
I make a new Project , then i "add files to project" and also "copy if needed" the following 2 files..
.a file (i.e.static library)
folder consisting the headers of library files
Now when I try to import a header file in my project , there is no "suggestion" appear ...but still i write and it does not give an error "header file not found"...
but when I run the project it gives the error like:
ld: warning: ignoring file
/Users/Subodh/Library/Developer/Xcode/DerivedData/LibraryImporting_test-cbchzzjdcehzvfgwmzbvifrnrwgk/Build/Products/Debug-iphoneos/libLibraryImporting_test.a,
file was built for archive which is not the architecture being linked
(i386):
/Users/Subodh/Library/Developer/Xcode/DerivedData/LibraryImporting_test-cbchzzjdcehzvfgwmzbvifrnrwgk/Build/Products/Debug-iphoneos/libLibraryImporting_test.a
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_LibraryImporting_test", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Plz guide me....point out if get wrong at some step....help plz
it will be better if someone mentions all the steps as i have done in making a library and using it in a project...it will be a great help
The key to the issue is this part of the error message:
file was built for archive which is not the architecture being linked
(i386)
You have imported the library built for the iPhone Device (ARM) by the look of it, and you are trying to use it in the iPhone Simulator which is i386.
What I would recommend is using an Xcode Workspace where the static library project is one of the projects and the iPhone app is another project. This way Xcode will build the library, as required, for Debug/Release and Device/Simulator.
I develop a project on XCode, in which I have added somme dylib. The project compiles, and execute nicely when launched with XCode.
But when I try to launch it in my shell, I got lib errors :
iMac-de-Remi-Doolaeghe:MacOS remidoolaeghe$ ./Adobe\ InDesign\ CS5
2011-12-16 10:08:55.160 Adobe InDesign CS5[8071:903] Error loading /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/Autocat.InDesignPlugin/Autocat: dlopen(/Applications/Adobe InDesign CS5/Plug-Ins/Autocat/Autocat.InDesignPlugin/Autocat, 265): Library not loaded: libboost_filesystem-xgcc42-mt-1_37.dylib
Referenced from: /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/Autocat.InDesignPlugin/Autocat
Reason: image not found
2011-12-16 10:08:55.161 Adobe InDesign CS5[8071:903] Error loading /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/AutocatUI.InDesignPlugin/AutocatUI: dlopen(/Applications/Adobe InDesign CS5/Plug-Ins/Autocat/AutocatUI.InDesignPlugin/AutocatUI, 265): Library not loaded: libboost_filesystem-xgcc42-mt-1_37.dylib
Referenced from: /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/AutocatUI.InDesignPlugin/AutocatUI
Reason: image not found
Bus error
That's an error I could workaround by copying the libs in my usr/lib folder. That's ok on my post. But that won't be ok when distributing it. I think I did something wrong with my linker in my XCode project, but can't see what.
I use XCode 3.2.6. The libs are presents in my targets, under "Link Binary With Libraries", and in "Libraries" folder under Groups&Files
I'm not sure if it matters, but my project is a plugin for Adobe InDesign.
Thanks in advance.
I'm speaking under correction, but if it is a dynamic lib, you would have to have that dynamic lib on the machine where it gets distributed to as well. You might be interested in packaging the dynamic lib into your installation wizard or something.
However if it was a static lib, you could have enforced to include all symbols by using one of the following flags:
-Obj-C
-all_load
-force_load
A nice explanation on what these flags do and how to use them can be found here: Objective-C categories in static library
I've been having trouble compiling my own OpenCV iOS project. I started with a simple command-line app target and I've now added an iOS app target. The problem is that my iOS target produces the following linker error:
ld: library not found for -lcv
collect2: ld returned 1 exit status
Command
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-g++-4.2
failed with exit code 1
I'm not sure where the flag, -lcv is coming from, as I haven't set it as any of the settings in my project's "Build Settings". I've downloaded a demo OpenCV iPhone project that compiles perfectly fine, and I've tried to copy the build settings from this project but I can't see what's different!
Thanks very much for any help.
Try adding in the project settings the path exact of the library since : /User/.....
important: only ONE ""