{"id":1457,"date":"2022-08-30T15:16:41","date_gmt":"2022-08-30T15:16:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/19\/how-can-i-linking-the-protocol-bufferc-into-the-xcode-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:16:41","modified_gmt":"2022-08-30T15:16:41","slug":"how-can-i-linking-the-protocol-bufferc-into-the-xcode-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-can-i-linking-the-protocol-bufferc-into-the-xcode-collection-of-common-programming-errors\/","title":{"rendered":"How can i Linking the Protocol Buffer(C++) into the Xcode-Collection of common programming errors"},"content":{"rendered":"<p>I added the <code>protobuf<\/code> class <code>\"xxx.pb.h\"<\/code>,<code>\"xxx.pb.cc\"<\/code> in Project. I added a path<code>\"\/usr\/local\/include\"<\/code> in <code>Header Search Paths<\/code>, and added a path<code>\"\/usr\/local\/lib\"<\/code> in <code>Library Search Paths.<\/code><\/p>\n<p>Now I encountered a problem, The following error at Build:<\/p>\n<pre><code>ld: warning: ignoring file \/usr\/local\/lib\/libprotobuf.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): \/usr\/local\/lib\/libprotobuf.dylib\nld: warning: ignoring file \/usr\/local\/lib\/libprotoc.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): \/usr\/local\/lib\/libprotoc.dylib\nUndefined symbols for architecture i386:\n\"google::protobuf::DescriptorPool::generated_pool()\", referenced from:\n      protobuf_AssignDesc_person_2eproto() in person.pb.o\n\"google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, int)\", referenced from:\n      protobuf_AddDesc_person_2eproto() in person.pb.o\n\"google::protobuf::MessageFactory::generated_factory()\", referenced from:\n      protobuf_AssignDesc_person_2eproto() in person.pb.o\n<\/code><\/pre>\n<p>&#8230; &#8230;<\/p>\n<pre><code>NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.\n  \"vtable for google::protobuf::Message\", referenced from:\n      google::protobuf::Message::Message() in person.pb.o\n  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.\nld: symbol(s) not found for architecture i386\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\n<\/code><\/pre>\n<p>Image<\/p>\n<ol>\n<li>\n<p>Follow the steps mentioned in this answer -&gt; http:\/\/stackoverflow.com\/a\/10279656\/1383704<\/p>\n<p>There are a few pitfalls here and there, for which you may check my own answer for the same qn.<\/p>\n<p>These were the steps I followed differently<\/p>\n<ol>\n<li>\n<p>instead of giving header search path till google directory, i gave the search path till the &#8220;src\/&#8221; directory<\/p>\n<\/li>\n<li>\n<p>In whichever you import your <code>xxx.pb.h<\/code> you have to rename the <code>.m<\/code> to <code>.mm<\/code><\/p>\n<\/li>\n<\/ol>\n<p>In Xcode 4.5 i was still getting some linker errors :<\/p>\n<blockquote>\n<p>symbols not found for architecture i386<\/p>\n<\/blockquote>\n<p>Because of this I wasn&#8217;t able to run on simulator. But the code will run on actual device.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-19 13:17:46. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I added the protobuf class &#8220;xxx.pb.h&#8221;,&#8221;xxx.pb.cc&#8221; in Project. I added a path&#8221;\/usr\/local\/include&#8221; in Header Search Paths, and added a path&#8221;\/usr\/local\/lib&#8221; in Library Search Paths. Now I encountered a problem, The following error at Build: ld: warning: ignoring file \/usr\/local\/lib\/libprotobuf.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1457","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1457"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1457\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}