C++ eclipse中的交叉编译器前缀和路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17316294/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cross compiler prefix and path in eclipse
提问by nish
I'm trying to create a C++ project on eclipse. I have installed eclipse-cdt for that.
我正在尝试在 Eclipse 上创建一个 C++ 项目。我已经为此安装了 eclipse-cdt。
While creating a project, a pop up window asks for cross compiler prefix and cross compiler path. Could someone please explain what are those and what do I need to add in those fields? Are those fields absolutely necessary to fill?
创建项目时,会弹出一个窗口,询问交叉编译器前缀和交叉编译器路径。有人可以解释一下这些是什么以及我需要在这些字段中添加什么吗?这些字段是否绝对需要填写?
回答by yeremy
If you are using a Mac, you can select MacOS GCC instead of Cross GCC. If you are on Windows, you will have to install a C++ compiler. I recommend you install Cygwin, try following the directions here. http://www3.ntu.edu.sg/home/ehchua/programming/howto/eclipsecpp_howto.htmlOnce you've installed the C++ compiler, restart Eclipse and try to create the project again. Hope this helps.
如果您使用的是 Mac,则可以选择 MacOS GCC 而不是 Cross GCC。如果您使用的是 Windows,则必须安装 C++ 编译器。我建议您安装 Cygwin,请尝试按照此处的说明进行操作。 http://www3.ntu.edu.sg/home/ehchua/programming/howto/eclipsecpp_howto.html安装 C++ 编译器后,重新启动 Eclipse 并尝试再次创建项目。希望这可以帮助。
回答by rmkyjv
In Cross compiler Prefix you need to write 'arm-none-eabi-' and in Cross compiler path you have to select the path for GCC bin folder. You need to install Cygwin GCC for this. I have found few steps in below link.
在交叉编译器前缀中,您需要编写“arm-none-eabi-”,在交叉编译器路径中,您必须选择 GCC bin 文件夹的路径。您需要为此安装 Cygwin GCC。我在下面的链接中找到了几个步骤。
https://www3.ntu.edu.sg/home/ehchua/programming/howto/Cygwin_HowTo.html#cygwin
https://www3.ntu.edu.sg/home/ehchua/programming/howto/Cygwin_HowTo.html#cygwin
回答by thuynt13
Just in case anybody else is like me and needs more explicit directions as @yeremy is correct in that you have to select MacOSX GCC. It's just that at the point where the OP is, he overshot where he could have made the selection and needs to back up a few windows (about 3) to choose the MacOSX GCC as the Toolchain of choice. Attaching a link below which goes through the steps and which also shows image of window where you can make the selection (figure 11).
以防万一其他人像我一样需要更明确的指示,因为@yeremy 是正确的,因为您必须选择 MacOSX GCC。只是在 OP 所在的地方,他超出了他可以选择的位置,需要备份几个窗口(大约 3 个)才能选择 MacOSX GCC 作为选择的工具链。在下面附上一个链接,该链接将完成这些步骤,并且还显示了您可以在其中进行选择的窗口图像(图 11)。
回答by Mark Jeronimus
When Eclipse doesn't detect a toolchain (to be installed separately) it only offers the option "Cross GCC". Don't choose that.
当 Eclipse 没有检测到工具链(需要单独安装)时,它只提供“Cross GCC”选项。不要选择那个。
Sites like thistell you that a properly installed toolchain (Cygwin / MinGW) is automatically discovered using the PATH
environment variable. This is not the case on my machine.
像这样的站点会告诉您使用PATH
环境变量自动发现正确安装的工具链(Cygwin / MinGW)。在我的机器上不是这种情况。
There's no way to configure a toolchain in Eclipse manually (as of writing) but you can fool Eclipse into finding one without changing your global PATH
:
没有办法在 Eclipse 中手动配置工具链(在编写时),但您可以欺骗 Eclipse 找到一个而不更改您的 global PATH
:
Go to Preferences/C/C++/Build/Environment,
转到Preferences/ C/C++/ Build/ Environment,
Add a variable PATH
and point it to your toolchain path(s), e.g. d:\Mingw\bin;d:\Mingw\msys\1.0\bin
. Separate paths with a semicolon.
添加一个变量PATH
并将其指向您的工具链路径,例如d:\Mingw\bin;d:\Mingw\msys\1.0\bin
. 用分号分隔路径。