OS X Eclipse C++ Launch Failed - Binary Not Found

前端 未结 15 1966
青春惊慌失措
青春惊慌失措 2020-12-24 07:17

I am quite troubled as this shouldn\'t be causing me such a headache. I\'ve downloaded the most recent Eclipse Indigo and all CDT C++ plugins for MAC OS X 10.7.1/<

相关标签:
15条回答
  • 2020-12-24 07:48

    I had the same problem, then I found a solution on this site. Let me explain shortly;

    1. Create your c++ project,
    2. Have a look at project properties(⌘I),
    3. Select Mach-O parser under binary properties,
    4. Write your codes down,
    5. Do not forget building your project (⌘B) before run.
    0 讨论(0)
  • 2020-12-24 07:48

    If your project name contains a "." (dot), the binary file will not be generated on building project. Remove all the "."(dots) from the project name and rebuilt it or try creating a new project.

    Happy coding!

    0 讨论(0)
  • 2020-12-24 07:50

    If you can successfully built but when try to run it getting error:

    Possible solution could be adding new configuration with full path to your binary output file

    (Run->Run Configuration...->Main->C++ Application):

    0 讨论(0)
  • 2020-12-24 07:53

    I am using Eclipse Juno with CDT on a 2007 Macbook running Snow Leopard. I have the two symptoms:

    1. No Binaries folder in Project Explorer, and
    2. The 'Launch failed. Binary not found' error.

    I have spent hours searching on Google for an answer, long enough to ascertain that these two symptoms are indicative of any number of problems which have been reported for not quite a decade without adequate resolution. That is a problem right there because after a decade there should have been more than enough input data to provide one troubleshooting procedure somewhere which walks the user step by step through the elimination of all possible causes.

    Instead, for hours I have read about a multitude of people, many of whom have resolved their particular problem but all of them seeming to have had to do something slightly different to get there.

    This should not be that difficult to resolve. Particularly in cases such as mine [but I am not the only one] when the Console view displays a Build with no errors yet the user can copy the binary file [which Eclipse bizarrely says it can not find] to the Desktop and run it without any problems from either Finder or a bash terminal session.

    All of this seems to be pointing rather emphatically toward the lack of adequate indicators in the Mach0 64 binary parser which should be designed to tell us exactly what it needs which it is not seeing.

    Admittedly, this is exacerbated in the case of MacBooks like mine which are running a 64bit OS [Snow Leopard] on a 64bit CPU which the manufacturer, unfortunately, hamstrung with a 32-bit bootup kernel. But, be forewarned, I have already tried the -arch i386 g++ switch, and the relinking of g++ to g++-4.0 without any change in the symptoms.

    ADDENDUM ADDED 10/07/2012:

    I am adding this checklist in the hope of clarifying a Way for the undoubtedly many others who will ask this question in the years to come. This Way reflects what I found to be necessary when using Eclipse Juno with a Mac running Snow Leopard:

    1) Go to Preferences->C/C++->New CDT Project Wizard, and under Preferred Toolchains, make sure all the Executable project types are set to MacOSX GCC.

    2) This is a biggie. I was able to get a Binaries folder in Project Explorer, and hence be able to run the project after building it, by using a Project name which does not contain dots ['.']. This I learned from another answer here, edited a few hours after my previous message. This requirement is easy to miss, hence a common one particularly if you are Eclipse experienced but only with other languages, because tutorials for other language plugins [such as with PyDev or for Java] frequently have you create Projects with dots in the name. If you have developed that habit with other languages, break it when using CDT for C/C++. Be forewarned, however, that it is not enough to just do a Right-Click and Rename an existing project name this time not using dots. The simplest Way is to delete your old project and create a new one with a name without dots.

    3) There are many websites cautioning you to make sure you either use the -arch i386 compiler switch or change the links for /usr/bin/gcc and /usr/bin/g++ to point to gcc-4.0 and g++-4.0 instead of gcc-4.2 and g++-4.2. I created a bash script to ease switching back and forth and investigated if this was necessary. It was not, at least not with my Macbook. Based on what I read at one site from a Mach-O developer, I suspect that the current version of Mach-0 64 goes both ways. Which is a good segue to ...

    4) In the Project Properties, not Preferences, go to C/C++ Build->Settings and under Binary Parsers make sure Mach-O 64 Parser is checked. Make sure this, and not the deprecated Mach-O parser, is checked.

    5) At this point, after you build your project, several things should be evident in the Project Explorer:

    6) There should now be a Binaries folder under project's folder.

    7) Within that Binaries folder should now be your executable file. It should have [x86_64/le] next to it if, like me, your Mac is effectively 32bit. Now is not the best time to get into the confusing topic of whether your Mac is effectively 32bit or 64bit. If you do not know, and a lot folks don't because Apple does make it confusing, check out the little app which can be downloaded from http://www.ahatfullofsky.comuv.com/English/Programs/SMS/SMS.html which will tell you What Is Truth. It is free, but the 'price' is that you have to scroll pass the ads at the top of the page reflecting the programmer's political disposition.

    0 讨论(0)
  • 2020-12-24 07:53

    You should change the settings for your project to build an executable instead of a dynamic library:

    Invoking: MacOS X C++ Linker g++ -arch i386 -dynamiclib -o "libHelloWorld" ./main.o`

    Go to project properties -> C/C++ Build -> Settings -> Build artifact, and select Executable in the first drop down list.

    0 讨论(0)
  • 2020-12-24 07:55

    on mac:

    1. Make sure you have xcode installed. Test it by writing "info g++" you must see proper information about the compiler.

    2. Build your project.

    3. Go to the folder of your project. You should see an executable file in Debug or realise folder, depending to your building configurations. If you d-click on the executable file you should see the result on the terminal.

    4. Back to Ecliipse, from Run/Run Configurations... and then browse to the folder that you have the executable file - one you already found - you can also change build configurations as you wish in that window. And make build automatic for each run.

    5. Run again it should work.

    Good luck !

    0 讨论(0)
提交回复
热议问题