linker command failed error in case of Twitter+Oauth libraries - objective-c

i am integrating twitter iOS app with my iOS app just for login purpose and for that i am using SCTwitter and Twitter+OAuth frameworks. but the problem is that when i build my project it gave me a compiler error like below:-
**ld: warning: directory not found for option '-L/Users/harvinder/Desktop/iphone_app 13/Twitter+OAuth/Libraries'
ld: warning: directory not found for option '-L&'
ld: warning: directory not found for option '-LHeaders'
ld: library not found for -lOAuth
clang: error: linker command failed with exit code 1 (use -v to see invocation)**
the above error clearly stated that the Twitter+OAuth library is not found but i have recheck my project and it is added and also i have tried many things like
1. library search paths($(PROJECT_DIR)/Twitter+OAuth/Libraries & Headers)
2.also check Link Binary And Libraries under build phases for libxml2.dylib and libOAuth.a
At last i delete the Twitter+OAuth folder and readded it and then everything works fine but the wired thing is that on the next day when i reopen my project in Xcode ,the same error encounter again and again i delete and readded the Twitter+OAuth folder and everything works fine again and same thing happens on the next day too. so i don't understand this weird behavior.
so please help me on this because everyday i have to delete and readd the folder to run my project.

Spaces are used to separate command line options and the directory with the library contains spaces, so you will need to ensure the command line interpreter doesn't see those spaces. That is generally done using quotes, so try this value in the Library Search Paths:
'$(PROJECT_DIR)/Twitter+OAuth/Libraries & Headers'
^ ^
Alternatively avoid using spaces in directory names.

Related

ld: framework not found GoogleMapsCore clang: error: linker command failed with exit code 1 (use -v to see invocation)

I don't know why I have this error("linker command failed with exit code 1 (use -v to see invocation)") on my IOS app.
This may happen because any of the following reasons.
if you do not import the framework properly.
if you are opening the .xcodeproj instead of .xcworkspace
Check the build settings -> Build Active Architectures only is set to No. (Then change it to YES)
Adding the other linker flags in Project and not in Targets. So, you move it to Targets, it shouldn't be in Project
I had a similar problem, and the problem was that mine Framework folder is not inside the project folder.
Build Settings > Framework Search Paths > enter these 2 lines in the window
$(PROJECT_DIR)/../<YOUR_FOLDER_WITH_FRAMEWORKS>
$(inherited)

Objective C Linker Error: Undefined Symbols

What does it mean to have undefined symbols?
There are no errors in the code files themselves and I am NOT using any external libraries.
I DID add a typedef NS_ENUM prior to this linker error occurring.
Where do I add this -v to see invocation?
Here is the error message:
Undefined symbols for architecture x86_64:
"_OBJC_IVAR_$_UIViewController._parentViewController", referenced from:
-[PEPI_LessonController setParentViewController:] in PEPI_LessonController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"Undefined Symbols"
Building source code files to an executable file consist of at least two steps:
Compile the source code files to intermediate binary files (often called xyz.o).
Link the intermediate binary files to the final executable file.
The error message "undefined symbols" is a linker message. It may appear even though the compilation process was successful without notice. The linker organizes final memory address relations and it replaces symbols that the compiler had to assume they would be valid later, if all parts of the code would be available. Without this, no modularization would be possible at all.
-v to see invocation
If you build your application in Xcode, then Xcode calls all the compile and link commands for you (CompileC, Ln, Clang ...). But remember that a typical IDE runs only the commands you could run by yourself in the shell. Theoretically, you could develop big applications only in a text editor and a shell. So I suggest take some time and try to copy paste some commands listed in the Xcode build report to a shell :-) You'll learn a lot about the backgrounds. Therefore, in my opinion, -v to see invocation is used while invoking the command in the shell - or in the build settings, if you wish permanently more information.
"External libraries"
Finally, try to clarify "external libraries". To look at the most simple example: even if you write a simple C program and you want to know something trivial like the length of a string, you'll include <glibc.h>. Now this is an external library. It's external to your program code. Are you sure you haven't included external libraries?
Solving linker problems
Linker errors are often confusing and somehow difficult, because details of the linked modules tend to be out of sight. You may find many hints if you enter the error message in a search engine. For example, have a look at here:
Undefined symbols for architecture armv7: "_SCNetworkReachabilityCreateWithAddress"
Even if all components are found for linking, all paths are known etc, they may have the wrong version or else.
It means it can't find the property parentViewController and method setParentViewController when linking your object files files. The most common cause for these types of errors is not linking a library or framework in your projects target. UIViewController is part of UIKit so I'd be surprised if it's not already linked. Is this an OSX project and your trying to use UIViewcontroller instead of NSViewController?
In my case I had forgotten to add the .m file to all the same targets as the .h and that's what caused this issue. In case it helps anyone thought I'd mention here... double check your target memberships!

Xcode linker issue

Everything was fine. I just deleted the old TestFlight folder from my Xcode project, and then dragged the new TestFlight SDK 3.0 into my project, and tried to build and got these errors.
ld: warning: directory not found for option
'-L"/Desktop/Work/Games/ClanKingdom/Game/src/Classes/TestFlightSDK1.2.4"'
ld: warning: directory not found for option
'-L"/Desktop/Work/Games/ClanKingdom/Game/src/Classes/Flurry"' ld:
warning: directory not found for option
'-L"/Desktop/Work/Games/ClanKingdom/Game/src/TestFlightSDK2.0.0"' ld:
warning: directory not found for option
'-L"/Desktop/Work/Games/ClanKingdom/Game/src/Flurry"' ld: warning:
directory not found for option
'-F"/Desktop/Work/Games/ClanKingdom/Game/src/FacebookSDK"' ld: library
not found for -lFlurry_4.2.3 clang: error: linker command failed with
exit code 1 (use -v to see invocation)
Why would it be giving me some issue for Flurry? I've not changed anything for Flurry, also I'm not sure why it's trying to link those older versions of TestFlight as I've deleted them.
Any ideas?
I know you've resolved this issue already, but for completeness you were linking your libraries using absolute file paths to a location where they no longer existed.
It looks like you were linking to the TestFlight library on your desktop. This is a really bad idea, you should either keep all your libraries in one sensible location, or keep copies of them locally in the source code of your project. That way you can modify your 'Library Search Paths' to a relative link, e.g.
$(SRCROOT)/Code\ Folder/Third\ Party\ Classes/Google\ Analytics
So $(SRCROOT) will point to the directory in which your xcode project lives, and you can manually enter the path to your library from there. The advantage being you will be able to move your libraries around with your codebase, but also in this instance simply replace the files within the folder at the path you've chosen, and everything should magically work!

Duplicate symbol _OBJC_CLASS_$_Facebook

I'm building an ARC iphone app, and about to integrate the addThis ios library.
I get the following error:
ld: duplicate symbol _OBJC_CLASS_$_Facebook in /Users/mars/Desktop/Pst/trunk/Pst/ThirdPartyLibs/FBConnect/FacebookSDK/FacebookSDK.framework/FacebookSDK(Facebook.o) and /Users/mars/Library/Developer/Xcode/DerivedData/Pst-bqmphjiqldalzsankfvxugsurcdj/Build/Intermediates/Pst.build/Debug-iphonesimulator/Pst.build/Objects-normal/i386/Facebook.o for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've double checked with my Compile Resource, and only 1 facebook.m is present.
I've also put "-fno-objc-arc" in my compiler flags for those library files because they are built without ARC
Any help would be really appreciated!!
I've got the same error when followed the instruction to drag ThirdPartyLibs to my project. It had added both FBConnect and FacebookSDK to my project.
If you open the AddThisDemo project, which comes with the library, you will see that only FacebookSDK and DeprecatedHeaders were added (not entire FBConnect). I have recreated this structure in my project and that had solved my issue.
Hope that helps!
For anyone with this issue but these answers are not helping: if you created one custom class and called it Facebook.h/.m, just change its name and after it, no more linkage errors.
You have a #import "facebook.m" in one of your files where you should have put #import "facebook.h".

Trouble when I try to run Archive command in XCode

I'm making an app with Facebook validation. It is working fine on simulator and in the device.
But, when I try to "Archive" (Product => Archive), I get this error:
ld: library not found for -lfacebook_ios_sdk
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The libraries are okay, otherwise it would not compile on simulator/device.
I don't know if this information is relevant, but my project is an ARC project.
Does anyone know what this error could mean?
I solved the problem by just removing the "libfacebook_ios_sdk.a" reference from my Link Binary Libraries and adding it again.
I dont know why it worked, but worked!