Xcode linker issue - objective-c

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!

Related

iOS manually exporting library causes issues

I made a library and I want to test it in a dummy project I made. Both projects are made in Objective-C. When I build my library I get a Successful Build message and three files under the Product directory:
FooIOS.bundle
libFooIOS.a
include
I place these three files at the root level of my dummy project and when I open my myDummyProject.xcworkspace file I see them in my project hierarchy. However, when I build my project I get the following error:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_FooSelectedPageViewController", referenced from:
objc-class-ref in libFooIOS.a(FooViewController.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I did away with some of the obvious checks:
Made sure to reference my external library
I also made sure that both my library and project architectures are set as armv7 arm64
I don't know what else to do. I may be missing another configuration step or it may even be the way I declared something in my library that doesn't conform with my dummy project. Or a discrepancy between projects, perhaps? Any hints or leads would be a great help. Thanks.

Calling Objective-C from Swift class causing linker errors

I'm trying to use RFDuino Objective-C library in Swift. It all sounds simple, I have called Objective-C from Swift classes before, no problem. This time however I hit the brick wall.
Created header file. Added header files to it. Swift can see the classes no problem. Project compiles fine.
The problem during build appears just after I try to call any of Objective classes
for example:
override func viewDidLoad() {
super.viewDidLoad()
let rfDuinoManager: RFduinoManager = RFduinoManager.sharedRFduinoManager()
}
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_RFduinoManager", referenced from:
__TMaCSo14RFduinoManager in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Im not sure what Im missing here.
Link to the project here.
https://www.dropbox.com/s/rza1ce01g4q5lp6/SmartHomeHub-stackoverflow.zip?dl=0
Thanks in advance for help. Honestly loosing hope now and considering rewrite whole library to Swift
The problem is how the rfduino folder was added to the project. So
Remove rfduino folder (selecting rfduino folder in the project navigator panel on left and hit delete button, but when it asks to move it to the trash or just remove references, choose "remove references".
Your bridging header has an absolute path reference, I'd suggest removing that altogether by selecting it in build settings and hitting delete button:
Re-add rfduino files back to the project, this time, under "added folders" option, choose "create groups" rather than "create folder references". If you want it to prompt to create proper bridging header for you, don't select folder, but select the individual files:
Also make sure that SmartHomeHub is checked below.
If you do that properly it will ask you to create bridging header automatically:
Go to this new bridging header and add your import lines again:
This is a linker error, not a compiler error. Are you sure the RFduino class (source or library) is included in your project (open the project membership panel on the right in Xcode and make sure the box is checked to include the library in your target).
If it is included, make sure it has x86_64 code compiled into it. It might be an iOS library and is just compiled for ARM. You can check by finding the binary and running lipo on it from the command line.
lipo -info [name of RFduinolibrary.a(dylib,whatever)]
it should show x86_64 as an architecture, ala:
Architectures in the file are: i386 x86_64
"The OPN [Debug] target overrides the OTHER_LDFLAGS build setting". This was the main issue. After adding $(inherited) in new line in other linker flags solved my issue.
For me, Removing all the files in 'derived dir', removing reference to the frameworks in my project and connect again and etc didn't work anymore. Only worked to me is to set 'Build Active Architecture Only' to 'YES'.

linker command failed error in case of Twitter+Oauth libraries

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.

ffmpeg 64bit Xcode

I'm trying to use the ffmpeg libraries in Xcode on Mac. I want to address to 64bit-systems like Lion and Mountain Lion. I tried to compile with
./configure --enable-static --enable-nonfree --enable-version3 --enable-gpl --disable-doc --disable-programs --arch=x86_64 --cc=cc --disable-yasm --host-cflags="-arch x86_64" --host-ldflags="-arch x86_64" --prefix=ffmpeg
Then I copied the ffmpeg-directory (with lib and include folders) into my project folder. I added the .a-files to my project and added the .a files to "Link binaries with Libraries"). Also I adjusted the header and library folder in the project settings. So far so good.
I'm a beginner with those libraries, so I started with opening a video. Works fine.
Now I'm trying to decode a given input file. Therefore I looked at this example file: http://ffmpeg.org/doxygen/1.0/decoding__encoding_8c-source.html
I copied the video_decode_example function. But at compiling I'm getting the following error:
Undefined symbols for architecture x86_64:
"_decode_write_frame", referenced from:
_video_decode_example in cutClass.o
ld: symbol(s) not found for architecture x86_64
What did I wrong at compiling ffmpeg?
decode_write_frame() is not part of ffmpeg — it's part of the sample code you were referring to. Read the sample code more closely and implement your own equivalent. (The implementation in the decoding_encoding.c sample is almost certainly not something you'd want in production code -- it just writes every frame to disk as a PGM image file.)

Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1

My XCode version is 4.2 for iOS 5.0. I choose "LLVM GCC 4.2" as the compiler. When I compile my project, it show me the following error:
ld: warning: directory not found for option '-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/gcc/arm-apple-darwin10/4.0.1'
ld: warning: directory not found for option '-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/gcc/arm-apple-darwin10/4.2.1'
ld: library not found for -lz.1.2.3
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1
Please help me figure out why this is happening and how to fix it.
The libz.1.2.3 library does not exist anymore (or at least is not included in the SDK). In your project settings, link with a newer version of the library like libz.1.2.5.