Skip to content

Instantly share code, notes, and snippets.

@BennettSmith
Created December 14, 2013 06:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BennettSmith/7956162 to your computer and use it in GitHub Desktop.
Save BennettSmith/7956162 to your computer and use it in GitHub Desktop.
Resolve C++ namespace collision when building Google Protobuf 2.5.0 with Xcode 5.0 for iOS 7.0 Apple includes a copy of protobuf as a private framework and if you link a locally built copy into and app that already uses the private framework version it will result in application crashes. Thanks Apple!
diff -rupN protobuf-2.5.0/src/google/protobuf/stubs/common.h protobuf-2.5.0-modified/src/google/protobuf/stubs/common.h
--- protobuf-2.5.0/src/google/protobuf/stubs/common.h 2013-02-26 09:56:38.000000000 -0800
+++ protobuf-2.5.0-modified/src/google/protobuf/stubs/common.h 2013-12-13 22:03:16.000000000 -0800
@@ -82,6 +82,13 @@ inline BOOL GetMessage(
namespace std {}
+// This is to get around a namespace collision between the privately built
+// copy of Google Protobuf and the copy linked into Apple's OpenGL ES
+// support.
+#if defined(__APPLE__)
+#define google google_private
+#endif
+
namespace google {
namespace protobuf {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment