OS X Eclipse C ++启动失败 - 未找到二进制文件 [英] OS X Eclipse C++ Launch Failed - Binary Not Found

查看:125
本文介绍了OS X Eclipse C ++启动失败 - 未找到二进制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困扰,因为这不应该让我头痛。我已经下载了最新的Eclipse Indigo和所有 CDT C ++插件,用于MAC OS X 10.7.1 /



安装完上述后重新启动CDT插件,我开发了一个简单的hello worldc ++应用程序,并尝试运行应用程序,启动失败,未找到二进制。错误信息。我已经阅读了多个修复,但没有一个工作。我尝试将-arch i386标志添加到链接器和编译器命令,仍然没有运气。



有没有人成功地在10.7.1上运行Eclipse C ++ ?这打扰了我的脑海。我可以简单地在VIM中编写相同的程序,并通过终端编译好,并执行得很好。 ECLIPSE不希望播放。



我将深深感激任何可以帮助的人!!!!!


$ b $编辑输出

  ****构建配置Debug for Project HelloWorld **** 
make all构建文件:../main.cpp
调用:GCC C ++编译器g ++ -I / Developer / SDKs / MacOSX10.6.sdk / usr / include -O0 -g3 - Wall -c -fmessage-length = 0 -arch i386-MMD -MP -MFmain.d-MTmain.d-omain.o../main.cpp
完成构建:../main.cpp
构建目标:libHelloWorld
调用:MacOS X C ++链接器g ++ -arch i386 -dynamiclib -olibHelloWorld./main.o
完成构建目标: libHelloWorld
****构建完成****


解决方案

我在运行雪豹的2007年Macbook上使用Eclipse Juno与CDT。我有两个症状:


  1. Project Explorer中没有Binaries文件夹,

  2. 启动失败。二进制未找到错误。

我已经花了几个小时在Google上搜索一个答案,足以确定这两个症状是指示性的在没有充分解决的情况下已经报告了十多年的问题。这是一个问题,因为十年后,应该有足够的输入数据来提供一个故障排除步骤,让步骤逐步消除所有可能的原因。



相反,几个小时我读了很多人,其中许多人解决了他们的特殊问题,但他们似乎都不得不做一些稍微不同的事情来到达那里。



这不应该是那么难解决。特别是在我这样的情况下(但我不是唯一的)当控制台视图显示一个没有错误的Build的时候,用户可以复制二进制文件[哪个Eclipse奇怪地说它找不到]到桌面并运行没有来自Finder或bash终端会话的任何问题。



所有这一切似乎都指向了强调Mach0 64二进制解析器中缺乏足够的指标应该将其设计为告诉我们 它没有看到什么需要。



诚然,这在加剧像我的MacBooks这样的一个64位操作系统[Snow Leopard]的64位CPU的制造商,不幸的是,搭载了一个32位的启动内核。但是,要预先警告,我已经尝试了-arch i386 g ++开关,并将g ++重新链接到g ++ - 4.0,而没有任何改变症状。



添加添加10 / 07/2012:



我正在添加这个清单,希望澄清一个方法,无疑许多其他人会在未来几年提出这个问题。这种方式反映了当使用Eclipse Juno与Mac运行Snow Leopard时,我发现有必要:



1)转到首选项 - > C / C ++ - >新CDT项目向导,并在首选工具链下,确保所有可执行项目类型都设置为MacOSX GCC。



2)这是一个biggie。我可以在Project Explorer中获取Binaries文件夹,因此可以通过使用不包含点['。']的项目名称来构建项目。这是我从另一个答案中学到的,在我之前的消息后几个小时进行了编辑。这个要求很容易错过,因此,特别是如果您是Eclipse经验丰富但只能使用其他语言,因为其他语言插件(例如使用PyDev或Java)的教程通常会在名称中创建带有点的项目。如果您已经开发了其他语言的习惯,那么在使用CDT for C / C ++时,请将其打破。然而,要预先警告,仅仅做一个右键点击并重新命名一个现有的项目名称,这次不使用点是不够的。最简单的方法是删除您的旧项目并创建一个名称不带点的新项目。



3)有许多网站提醒您,以确保您使用-arch i386编译器切换或更改/ usr / bin / gcc和/ usr / bin / g ++的链接指向gcc-4.0和g ++ - 4.0而不是gcc-4.2和g ++ - 4.2。我创建了一个bash脚本来轻松切换来回调查,如果这是必要的。这不是,至少不是我的Macbook。基于我在Mach-O开发人员的一个站点上读到的内容,我怀疑Mach-0 64的当前版本有两种。 4)在项目属性,而不是首选项中,转到C / C ++ Build-> Settings,在二进制解析器下确保Mach -O 64解析器被检查。确保这个,而不是已弃用的Mach-O解析器被检查。



5)在这一点上,在您构建项目之后,有几件事情应该在项目资源管理器:



6)现在应该有项目文件夹下的Binaries文件夹。



7) Binaries文件夹现在应该是您的可执行文件。它应该有[x86_64 / le]旁边,如果像我一样,你的Mac有效的32位。现在不是进入迷惑话题的最佳时机,无论你的Mac是32位还是64位。如果你不知道,并且很多人不是因为苹果确实令人困惑,请查看可以从 http://www.ahatfullofsky.comuv.com/English/Programs/SMS/SMS.html ,这将告诉你什么是真相。它是免费的,但价格是您必须滚动页面顶部的广告,反映程序员的政治处置。


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/

Upon restarting after installing the above CDT plugins, I've developed a simple 'hello world' c++ application and have tried running the application, "Launch failed. Binary not found." error message. I've read multiple fixes but none have worked. I tried adding the -arch i386 flag to the linker and compiler commands, still no luck.

Has anyone successfully gotten Eclipse C++ running on 10.7.1?????? This blows my mind. I can simply write the same program in VIM and compile it just fine via the terminal and execute just fine. ECLIPSE DOESN'T WANT TO PLAY ALONG.

I will be deeply indebted to anyone who can help!!!!!

EDIT: compiler output

**** Build of configuration Debug for project HelloWorld ****
make all Building file: ../main.cpp
Invoking: GCC C++ Compiler g++ -I/Developer/SDKs/MacOSX10.6.sdk/usr/include -O0 -g3 -Wall -c -fmessage-length=0 -arch i386 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
Finished building: ../main.cpp
Building target: libHelloWorld
Invoking: MacOS X C++ Linker g++ -arch i386 -dynamiclib -o "libHelloWorld" ./main.o
Finished building target: libHelloWorld
**** Build Finished ****

解决方案

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.

这篇关于OS X Eclipse C ++启动失败 - 未找到二进制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆