I am getting the error you see in the photo when I import the SKPSMTPMessage library:
The point is that I have no idea what it means. I have done a clean, I have added the files under the Compile Sources, and I have added the CFNetwork framework. Any idea what it means??
You're getting all sorts of "duplicate symbol errors" getting spewed because the same symbols are defined in both a file you're including ("Base64Transcoder.m") and a SDK you are including (the DropBox SDK). So the compiler doesn't know which symbol you really want to use at run time.
I recommend removing "Base64Transcoder.m" from your project, at least temporarily, to see if all those duplicate symbol errors go away.
Related
I am updating a legacy project which was built in objective-c. I am currently battling 2 issues with that project.
The legacy project has enabled lot of compiler flags and building the project throws this warning conflicting nullability specifier on return types, 'nullable' conflicts with existing specifier 'nonnull' for stuff like this - (nullable instancetype)init NS_UNAVAILABLE
I understand why it is showing it and I believe it is showing this warning because the project has --Wnullability-declspec flag ON.
I can turn it off and the warning disappears. However, if I put it back then the warning does not come back. I got baffled by it. I cleaned up the project and made sure there are no filters set but still could not figure out why xcode stops showing the warning.
(I do know the correct fix is not to remove the flag and I know how to fix the issue in the code. I am just amused the xcode stops showing the warnings). So, I am trying to figure how why xcode behaves this way.
The warning which is coming is actually in the library header which this project includes.
I own that library. So, I tried to add that compiler option(--Wnullability-declspec) to that libs source code and see if I get the warning. But I don't see that warning in that libs source code.
So, the other question which I have is why I get the warning in the project which includes this library and not in the actual library.
I have developed an application using ZBarSDK for Barcode. It is working fine with 32 bit support, but while I am going to upgrade it to 64 bit, it is giving linker error. Is there any tutorial or way to find out the solution ? Below are the warnings, with linker error.
duplicate symbol in:
projectpath/arm64/main.o
projectpath/arm64/AppDelegate.o
duplicate symbol in:
projectpath/arm64/main.o
projectpath/arm64/ViewController.o
etc...
This kind of warnings and linker error is there for every controller. I konw, this kind of warning comes when there are similar named class are twice or more time in source code, but if I remove 64 bit it is working fine. How to get rid of this kind of linker error.
I'm not sure about the command to merge two or more libraries, I have tried for simulator and device library. After failure, my Sr. helped me and created this attached library.
This SDK I have used before 2 years to support 64bit in my application and was working fine. Not sure about any new changes made by ZBARSDK Team
I have uploaded my SDK at https://www.dropbox.com/sh/zhbqsa0heuputlk/AAC1kDkJBxgybtwi7lnmZ9lra?dl=0
You can try this sdk.
Thanks
duplicate symbol _llvm.cmdline in:
/Users/inntot/Documents/navigationdrawer 2 2 2 2 2/Pods/GoogleInterchangeUtilities/Frameworks/GoogleInterchangeUtilities.framework/GoogleInterchangeUtilities(Descriptor.pb.o)
/Users/inntot/Documents/navigationdrawer 2 2 2 2 2/Pods/GoogleSymbolUtilities/Frameworks/GoogleSymbolUtilities.framework/GoogleSymbolUtilities(overload.o)
duplicate symbol _llvm.embedded.module in:
/Users/inntot/Documents/navigationdrawer 2 2 2 2 2/Pods/GoogleInterchangeUtilities/Frameworks/GoogleInterchangeUtilities.framework/GoogleInterchangeUtilities(Descriptor.pb.o)
/Users/inntot/Documents/navigationdrawer 2 2 2 2 2/Pods/GoogleSymbolUtilities/Frameworks/GoogleSymbolUtilities.framework/GoogleSymbolUtilities(overload.o)
A duplicate symbol error means that somewhere in your project being compiled, something that can only be defined once (like a function, const or class) is being defined twice, and hence the name, duplicated, so the compiler is unsure which definition to use.
However, it is highly likely that this is not a problem with you. These particular symbols, namely _llvm.cmdline and _llvm.embedded.moduleare not generally user-defined symbols and are generally created instead by a framework that you are using, people have encountered this error using frameworks by Twitter and Facebook as well. Looking at the paths to the two files where there are conflicting symbols confirms my suspicion. The errors are being generated in a file in the Google Utils framework.
Firstly, if you made any changes to these google framework files themselves, undo them, as your added or changed code may be the problem.
There are a few fixes that may work for you. The first is that this could be a cocoapods issue. Ensure that you have the default "Debug" and "Release" build configurations in your project, otherwise cocoapods will not handle this well. The next fix that I would suggest is to not include the GoogleInterchangeUtilities framework in the project. GoogleSymbolUtilities was in fact introduced to fix this error cropping up in other google frameworks, so try ONLY including googleSymbolUtilities in your project rather than both symbolutilities and interchangeutilities. Failing that, If there are other versions of these two google frameworks you can download, download a different version, as a fix might have been released or you can find a version before this bug occurred.
If none of these work for you then I would advise getting in touch with google to notify them of this issue, and then sitting tight for a fix.
You can try
Project-> Build Settings-> Enabled bit code (change it From Yes to No) i hope it works for you, if it doesn't please check your pods updated or not or if still your facing problem give some details about issue.
Apple uses the following code in the header of all its framework classes.
#if !defined(__COREFOUNDATION_CFARRAY__)
#define __COREFOUNDATION_CFARRAY__ 1
...
#endif
Is this a recommended approach for eliminating "duplicate symbol" linker errors, when designing classes or categories for framework use, or are these left over protection from the use of #include instead of #import in c?
Research into this has lead me to this article on include guard
NOTE: this question is not asking how to fix a duplicate symbol error, but instead asking if there is any way of preventing your own code from causing the problem if its included more than once in a project.
You're right about the include guard - there's probably some compatibility reason it's not been removed from the source.
However, this won't really protect you against duplicate symbols much.
For example,
What if you have two third party library, each of which uses the SBJSON library (I had this happen to a colleague a few weeks ago).
Each of the libraries was compiled seperately so, from their point of view, SBJSON was only included once. However, when I came to link my app I couldn't because I had duplicate symbols.
I had to solve this by manually removing the symbols from one of the .a library files (This link shows it's quite a common problem!)
EDIT : This link is a much clearer step by step solution to the problem
Apple uses the following code in the header of all its framework classes.
Not necessarily for the ObjC APIs. But CoreFoundation, yes they use include guards. It's still idiomatic in many camps to use traditional #includes in C sources, and to use #import for objc sources (#import is a compiler extension, not traditional C).
Is this a recommended approach for eliminating "duplicate symbol" linker errors
No, it does not prevent linker errors; it can result in duplicate declaration errors during compile phases.
If you're getting duplicate symbol linker errors, the problem is something else, such as visibility of definition. For that, you should provide an example of your troubling program.
I'm trying to get FMDB to work with Rubymotion but every time I try to build the app I get this error:
FMDBTest(master):rake
Build ./build/iPhoneSimulator-5.1-Development
Build vendor/Pods
Link ./build/iPhoneSimulator-5.1-Development/FMDBTest.app/FMDBTest
ld: duplicate symbol _main in ./build/iPhoneSimulator-5.1-Development/objs/main.o and /Users/Bodacious/Apps/FMDBTest/vendor/Pods/build-iPhoneSimulator/libPods.a(fmdb.o) for architecture i386
Here's the app I'm using to test: https://github.com/Bodacious/FMDBTest
Has anybody else got this to work? :/
I don't know RubyMotion, but have had similar problems as I've included FMDB into projects. Bottom line, exclude fmdb.m from your build. It has it's own main() function, which is useful for testing, but it when included in a project, it gives you an error like this. You need the FMDB classes, but not fmdb.m.
I've build an ActiveRecord-like adapter for MotionModel that uses FMBD. As of now, it can be found at https://github.com/aceofspades/MotionModel/commits/sql.