Eclipse C++ in OSX :: program is not a recognized executable

This morning I encountered a strange debugging problem in Eclipse. I couldn’t set the executable in my debug configurations because the executable wasn’t recognized. Strange enough as I could perfectly execute it from command line. After a bit of try/error and internet investigation I finally found the answer. From OSX snow leopard on, gcc seems to build 64 bit executables by default. And those won’t be recognized from Eclipse in return. To solve the error, you’ve got to explicitly set your architecture to i386.

Enter your project properties and add the command line option “-arch i386” for each C++ Linker, C++ Compiler and C Compiler. After a clean build, you should be clear to debug again. In Linker options make sure to NOT set it up as -Xlinker option.