如何将 C++ 插件安装到 Eclipse? [英] How to install C++ plugin to Eclipse?

查看:23
本文介绍了如何将 C++ 插件安装到 Eclipse?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Eclipse Helios 并想使用它编写 C++ 代码,但我一直遇到启动失败.二进制未找到"错误.

我使用mingw-get-inst-20120426"安装了 MingW C++ 编译器.文件并选择C编译器、C++编译器、MSYS Basic System和MingW Developer Toolkit".

然后我去了 Eclipse >项目>属性>C/C++ 通用 >路径和符号,然后在 Includes 选项卡中选择 GNU C++ 并添加C:MinGWlibgccmingw324.6.2includec++"路径.

我也去了 C/C++ build >环境并附加了C:MinGWin;C:MinGWmsys1.0in"到 PATH.

然后我创建了一个Hello World C++项目,选择Toolchains下的MingW GCC,然后使用锤子"构建项目.图标.

但是,一旦我运行 HelloWorld 程序,它就会得到启动失败.未找到二进制文件"错误.

这是另一个错误:

g++ -IC:MinGWlibgccmingw324.6.2includec++ -O0 -g3 -Wall -c -fmessage-length=0 -osrcHelloWorld.o ..srcHelloWorld.cpp内部生成器:无法运行程序g++":系统找不到指定的文件.

我还下载了 CDT(C/C++ 开发工具)并转移了功能".和插件"文件夹到eclipse文件夹.

有人可以告诉我如何解决这个问题吗?

解决方案

首先,在以下示例中,所有驱动器号都应替换为系统上的相关驱动器号.并非所有这些步骤都是真正必要的,但它确实有效(而且越多越好).

我们从稍微简单一点的发布配置开始——我们想让它编译.<​​/p>

转到项目 -- 属性

查看包含目录是否正确且到位.

转到项目 -- 属性 -- 运行/调试设置 -- 新 -- 主选项卡

设置为 Release 并浏览到项目的 Release 文件夹.如果 exe 文件未设置,请输入其名称.

切换到常用选项卡.选中分配控制台并在后台启动.还没有运行.

转到项目 -- 属性 -- C/C++ 构建 -- 发现选项

工具 -- GCC C++ 编译器

浏览"到mingw bin文件夹并选择g++.exe或将mingw32-g++.exe复制到g++.exe

注意:图片指向mingw32-g++.exe请使用g++.exe

在项目上右击查看--Build Configurations--Set Active--Release被勾选.

右键项目——运行方式——运行配置.

在 C/C++ Application 下选择,指的是发布版本.然后点击运行

如果可行,我将向您展示如何设置调试属性.(更复杂)

I have Eclipse Helios and wanted to code C++ using it, but I keep running into the "Launch failed. Binary Not found" error.

I installed the MingW C++ compiler using the "mingw-get-inst-20120426" file and selected the "C compiler, C++ compiler, MSYS Basic System, and MingW Developer Toolkit".

Then I went to Eclipse > project > properties > C/C++ General > Paths and Symbols, then selected the GNU C++ in the Includes tab and added the "C:MinGWlibgccmingw324.6.2includec++" path.

I also went to C/C++ build > Environment and appended the "C:MinGWin;C:MinGWmsys1.0in" to the PATH.

Then I created a Hello World C++ project, selecting the MingW GCC under Toolchains, and then built the project using the "hammer" icon.

However, once I ran the HelloWorld program it gets the "Launch failed. Binary Not Found" error.

Here is another error:

g++ -IC:MinGWlibgccmingw324.6.2includec++ -O0 -g3 -Wall -c - 
fmessage-length=0 -osrcHelloWorld.o ..srcHelloWorld.cpp
Internal Builder: Cannot run program "g++": The system cannot find the 
file specified.

I also downloaded the CDT (C/C++ Development Tooling) and transferred the "features" and "plugins" folder to the eclipse folder.

Can someone please give me step-by-step on how to resolve this?

解决方案

Firstly, in the following examples all drive-letters should be replaced with the relevant ones on your system. Not all of these steps are really necessary, but it works (and the more the merrier).

We start with the slightly simpler release config - we want to make it compile.

Go to Project -- Properties

Look if the include directories are correct and in place.

Go to Project -- Properties -- Run/Debug Settings -- NEW -- Main Tab

Set to Release and Browse to the Release folder of the project. If the exe file is not set type in its name.

Switch to Common Tab. Check Allocate Console and Launch in Background. Don't Run yet.

Go to Project -- Properties -- C/C++ Build -- Discovery Options

Tools -- GCC C++ Compiler

"Browse" to the mingw bin folder and select the g++.exe or copy mingw32-g++.exe to g++.exe

Note: The image points to mingw32-g++.exe please use g++.exe

Right click on the project and look -- Build Configurations -- Set Active -- Release is checked.

Right click on the project -- Run As -- Run Configurations.

Under C/C++ Application select, the one which refers to the release version. Then click Run

If this works, I will show you how to set the Debug Properties. (more complicated)

这篇关于如何将 C++ 插件安装到 Eclipse?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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