iOS clang error: duplicate symbols for architecture i386 when the project has to use Linker Flags

Hello,

I'm working on the iOS project that has already had some third party frameworks requiring to add the following other linker flags:

-ObjC
-lresolv
-lstdc++

When I'm trying to install the PDFNet framework, I got the error:

duplicate symbol _OBJC_CLASS_$_Font in:
    /Users/haink/Library/Developer/Xcode/DerivedData/XXX-fzlghuveruxkgdfkhjtxakasd/Build/Intermediates/XXX.build/Debug-iphonesimulator/XXX.build/Objects-normal/i386/Font.o
    /Users/haink/data/XXX/XXX/PDFNet/PDFNet_iOS/Lib/PDFNet.framework/PDFNet(Font.o)

duplicate symbol _OBJC_METACLASS_$_Font in:
    /Users/haink/Library/Developer/Xcode/DerivedData/XXX-fzlghuveruxkgdfkhjtxakasd/Build/Intermediates/XXX.build/Debug-iphonesimulator/XXX.build/Objects-normal/i386/Font.o
    /Users/haink/data/XXX/XXX/PDFNet/PDFNet_iOS/Lib/PDFNet.framework/PDFNet(Font.o)

duplicate symbol _OBJC_CLASS_$_Selection in:
    /Users/haink/Library/Developer/Xcode/DerivedData/XXX-fzlghuveruxkgdfkhjtxakasd/Build/Intermediates/XXX.build/Debug-iphonesimulator/XXX.build/Objects-normal/i386/Selection.o
    /Users/haink/data/XXX/XXX/PDFNet/PDFNet_iOS/Lib/PDFNet.framework/PDFNet(Selection.o)
duplicate symbol _OBJC_METACLASS_$_Selection in:

    /Users/haink/Library/Developer/Xcode/DerivedData/XXX-fzlghuveruxkgdfkhjtxakasd/Build/Intermediates/XXX.build/Debug-iphonesimulator/XXX.build/Objects-normal/i386/Selection.o
    /Users/haink/data/XXX/XXX/PDFNet/PDFNet_iOS/Lib/PDFNet.framework/PDFNet(Selection.o)

ld: 4 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any help would be appreciated.
Thanks,
Hai.

Hello Hai,

The errors appear to be due to a naming conflict between PDFNet and the other library you are using. We have recently changed our class names to be prefixed with PT to avoid this problem. If you download the latest unofficial version of PDFNet for iOS and change your code to refer to the PDFNet classes with PT prefixed, these errors should be resolved. The next official version will also prefix its class names PT.

Note that PDFNet for iOS uses libc++, the LLVM version of the C++ standard library and Xcode’s default C++ library. Including a library that relies on the GNU version of the C++ standard library (libstdc++) may cause linking problems that may or may not be possible to work around.

James

When do you plan to release the next official version? I need that date to see if it can fit to my release plan, or we need to have a workaround at this time, due to we can't use unofficial version for our production release.

Thanks,
Vinh.

Hi Vinh,

We don’t have a timeline for the next official release, but in the meantime I would not be afraid to use the unofficial release. It is stable and has no known issues. It simply has not undergone the rigorous testing that we do for an official release. Many of our customers use unofficial builds in their production software.

Best Regards,

James