{"id":68,"date":"2009-09-13T04:07:03","date_gmt":"2009-09-13T04:07:03","guid":{"rendered":"http:\/\/www.mrericsir.com\/blog\/?p=68"},"modified":"2023-07-14T20:20:23","modified_gmt":"2023-07-14T20:20:23","slug":"cc-with-eclipse-galileo-on-mac-os-10-6","status":"publish","type":"post","link":"https:\/\/www.mrericsir.com\/blog\/technology\/cc-with-eclipse-galileo-on-mac-os-10-6\/","title":{"rendered":"C\/C++ with Eclipse Galileo on Mac OS 10.6"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Getting Eclipse to compile your C\/C++ applications on Linux has always been a breeze.&nbsp; On Windows, it&#8217;s always been hell.&nbsp; And on Mac, it&#8217;s somewhere in between.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s what you need to get started:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Your Mac OS install DVD has a few optional components that aren&#8217;t part of the standard installation.&nbsp; One of these is XCode, which is Apple&#8217;s wonky IDE.&nbsp; It comes with the GNU toolchain, which is exactly what you&#8217;ll need.&nbsp; If you&#8217;ve installed the right thing, you should be able to open a new terminal window (note: a NEW terminal window) and run &#8220;gcc&#8221;.&nbsp; If it&#8217;s installed, it will return with something like &#8220;gcc: no input files.&#8221;&nbsp; Which is true &#8212; you didn&#8217;t give it any input files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now onto the next problem.&nbsp; Eclipse&#8217;s C\/C++ Development Tools (CDT) plugin doesn&#8217;t work with 64-bit binaries without some significant tweaks because it won&#8217;t recognize the binary as a valid application. And on Snow Leopard, GCC compiles 64-bit by default.&nbsp; Damn!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There&#8217;s two workarounds for this, use whichever one suits you best (but not both!):<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Switch back to 32 bit binaries.<\/strong> In each project, right click and select Properties, and open the C\/C++ Build section, and click settings.&nbsp; Under MacOS X C++ Linker, click Miscellaneious.&nbsp; There&#8217;s three text fields; in the one that just says Linker flags, add &#8220;-arch i386&#8221; (without the quotes).&nbsp; Then go to the GCC C++ Compiler section, hit Miscellaneous, and add the same text to the Other flags box.&nbsp; Now you just need to do a clean build, and you should be good to go.<\/li>\n\n\n\n<li><strong>Don&#8217;t use the Run dialog<\/strong>.&nbsp; You can use the Run External command to run the 64-bit executable.&nbsp; This can be somewhat annoying if you have several build options, or you like changing the name of your project.&nbsp; But it works.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Remember, you only need to make ONE of the above changes. Don&#8217;t make both!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hopefully this helped someone out there.&nbsp; And even more hopefully, this will be fixed in the next verison of Eclipse.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Update<\/strong>: forgot the &#8220;i&#8221; in &#8220;i386&#8221; and added emphasis about only making one of the two changes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting Eclipse to compile your C\/C++ applications on Linux has always been a breeze.&nbsp; On Windows, it&#8217;s always been hell.&nbsp; And on Mac, it&#8217;s somewhere [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","slim_seo":{"title":"C\/C++ with Eclipse Galileo on Mac OS 10.6 - MrEricSir.com","description":"Getting Eclipse to compile your C\/C++ applications on Linux has always been a breeze.&nbsp; On Windows, it's always been hell.&nbsp; And on Mac, it's somewhere"},"autoblue_enabled":true,"autoblue_custom_message":"","autoblue_shares":[],"autoblue_post_url":"","autoblue_publish_document":false,"footnotes":""},"categories":[3],"tags":[40,39,41,42,43],"class_list":["post-68","post","type-post","status-publish","format-standard","hentry","category-technology","tag-c","tag-eclipse","tag-gcc","tag-mac","tag-osx"],"_links":{"self":[{"href":"https:\/\/www.mrericsir.com\/blog\/wp-json\/wp\/v2\/posts\/68","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mrericsir.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mrericsir.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mrericsir.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mrericsir.com\/blog\/wp-json\/wp\/v2\/comments?post=68"}],"version-history":[{"count":7,"href":"https:\/\/www.mrericsir.com\/blog\/wp-json\/wp\/v2\/posts\/68\/revisions"}],"predecessor-version":[{"id":10550,"href":"https:\/\/www.mrericsir.com\/blog\/wp-json\/wp\/v2\/posts\/68\/revisions\/10550"}],"wp:attachment":[{"href":"https:\/\/www.mrericsir.com\/blog\/wp-json\/wp\/v2\/media?parent=68"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mrericsir.com\/blog\/wp-json\/wp\/v2\/categories?post=68"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mrericsir.com\/blog\/wp-json\/wp\/v2\/tags?post=68"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}