How to link libs in Xcode7 - xcode

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.

Related

How to fix a library not found error on Xcode

I use Xcode 11.3.1.
I receive an Xcode project from a coworker that is using Xcode 12.4.
I open the project and try to build it.
I receive the following error:
Library not found for ISO8601DateFormatterValueTransformer
Inside Xcode there are some details:
ld: warning: directory not found for option '-L/Users/catalina/Library/Developer/Xcode/DerivedData/CDA-chskvgcrkhxpgnghuarozjoeymbq/Build/Products/Debug-iphonesimulator/ISO8601DateFormatterValueTransformer'
ld: warning: directory not found for option '-L/Users/catalina/Library/Developer/Xcode/DerivedData/CDA-chskvgcrkhxpgnghuarozjoeymbq/Build/Products/Debug-iphonesimulator/RKValueTransformers'
ld: warning: directory not found for option '-L/Users/catalina/Library/Developer/Xcode/DerivedData/CDA-chskvgcrkhxpgnghuarozjoeymbq/Build/Products/Debug-iphonesimulator/RestKit'
ld: warning: directory not found for option '-L/Users/catalina/Library/Developer/Xcode/DerivedData/CDA-chskvgcrkhxpgnghuarozjoeymbq/Build/Products/Debug-iphonesimulator/SOCKit'
ld: warning: directory not found for option '-L/Users/catalina/Library/Developer/Xcode/DerivedData/CDA-chskvgcrkhxpgnghuarozjoeymbq/Build/Products/Debug-iphonesimulator/TransitionKit'
ld: warning: directory not found for option '-L/Users/catalina/Library/Developer/Xcode/DerivedData/CDA-chskvgcrkhxpgnghuarozjoeymbq/Build/Products/Debug-iphonesimulator/ZBarSDK'
ld: library not found for -lISO8601DateFormatterValueTransformer
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My coworker said to me to delete the Pods folder and run the pod install command. After running the command some libraries are installed on the project.
But when I try to build the project, it fails.
This problem could be related to my Xcode version? I mean, I was trying to compile a project using an old version of Xcode
Or
this is a problem related to not importing correctly the Library?
I find out what was causing the problem.
I open the xcproject file. The correct file to open the project is the xcworkspace file.
The problem is fixed now.

No such file or directory when archiving

I added Firebase to my Xcode project using cocoapods. I can build and it succeeds, I only get this warning:
ld: warning: directory not found for option '-F/Users/.../Library/Developer/Xcode/DerivedData/game-dwgqybwtgjx..../Build/Intermediates/ArchiveIntermediates/game/BuildProductsPath/Release-iphoneos/GoogleToolboxForMac'
ld: warning: directory not found for option '-F/Users/.../Library/Developer/Xcode/DerivedData/game-dwgqybwtgj..../Build/Intermediates/ArchiveIntermediates/game/BuildProductsPath/Release-iphoneos/Protobuf'
The build succeeds but the archive doesn't.
When I click archive I get these warnings and errors:
/Users/..../Library/Developer/Xcode/DerivedData/game-dwgqybwtg.../Build/Intermediates/ArchiveIntermediates/game/InstallationBuildProductsLocation/Applications/game.app/Frameworks/GoogleToolboxForMac.framework: No such file or directory
Managed to fix the problem by updating macOS and Xcode

static Library in Xcode 4

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.

Dynamic Linking Error - Xcode 4

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?

Including headers in an Xcode 4.2.1 project

I'm trying to use a library, specifically SOIL (Simple OpenGL Image Library) in Xcode 4.2.1. Under Build Phases -> Link Library with Libraries I add all the .h and .c files that came with the SOIL zip archive.
When I build the project, I get the following error message for every .h and .c file added:
warning: skipping file '/Users/saw/XcodeProjects/Assignment01 copy/Assignment01/image_DXT.c'
(unexpected file type 'sourcecode.c.c' in Frameworks & Libraries build phase)
and a linker error:
"_SOIL_load_OGL_texture", referenced from: Init() in main.o Symbol(s)
not found for architecture x86_64 Clang: error: linker command failed
with exit code 1 (use -v to see invocation)
.h and .c files aren't libraries. Add the .c files to the compile phase and just #import the .h files where needed.
To verify linking I have done the following:
Create a new Mac Cocoa application.
Add 10 files from the SOIL src
folder: SOIL.c, image_DXT.h, stbi_DDS_aug.h, SOIL.h, image_helper.c,
stb_image_aug.c, stbi_DDS_aug_c.h, image_DXT.c, image_helper.h, and
stb_image_aug.h.
Tell Xcode to copy them to my project.
Add one line
to my app delegate's applicationDidFinishLaunching: method:
SOIL_load_OGL_texture( "img_test.png", SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID, 0 );.
Build the target for running.
Although there are a variety of compiler warnings about data conversion, these steps produce an executable with no linker errors.
Try adding -framework to your framework's name in the "Other Linker Flags" such as:
-framework SOIL

Resources