[英]Eclipse with CDT on Mac
I've been trying to get Eclipse with CDT working on my Mac for a while now. 我一直试图让我的Mac上的CD与我的Mac一起工作一段时间。 Everything I've searched for talks about Windows and I'm officially stuck.
我搜索过关于Windows的所有内容,我正式陷入困境。
The errors I get are: 我得到的错误是:
Program "g++" not found in PATH
Program "gcc" not found in PATH
and a few more that seem to stem from a problem with my PATH. 还有一些似乎源于我的PATH问题。 I checked gcc, g++, make, and gmake in terminal using --version and they're all installed.
我使用--version检查了终端中的gcc,g ++,make和gmake,它们都已安装完毕。 Eclipse CDT is supposed to detect where to look for PATH variables and I can't figure out where I would change it or how to change it.
Eclipse CDT应该检测在哪里查找PATH变量,我无法弄清楚我将在哪里更改它或如何更改它。 Any help would be greatly appreciated!
任何帮助将不胜感激!
Edit: The original problem was fixed. 编辑:原始问题已修复。 My PATH variable in eclipse was empty for some reason so I had to add locations like /usr/bin and /usr/local/bin.
由于某些原因,eclipse中的我的PATH变量是空的,因此我必须添加/ usr / bin和/ usr / local / bin等位置。 Now I get the error that "Symbol 'cout' could not be resolved."
现在我收到“Symbol'cout'无法解决的错误。”
Edit 2: I was able to get everything working by uninstalling everything and reinstalling Eclipse Indigo with CDT. 编辑2:通过卸载所有内容并使用CDT重新安装Eclipse Indigo,我能够完成所有工作。
There is no C / C++ compiler installed. 没有安装C / C ++编译器。
Options are: 选项包括:
Once installed make sure you can call the compiler from the command line (type gcc) if it does not work the compiler has not been added to the environment path variable. 安装完成后,请确保可以从命令行调用编译器(键入gcc),如果它不起作用,则编译器尚未添加到环境路径变量中。
Some extra help: How do I install g++ on MacOS X? 一些额外的帮助: 如何在MacOS X上安装g ++?
Here is a great tutorial that shows all the necessary steps for linux. 这是一个很棒的教程,显示了linux的所有必要步骤。 I think it should be quite similar.
我认为它应该非常相似。
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/ http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/
Maybe you'll have to add the path to gcc to your PATH variable if none of this is helping. 如果没有任何帮助,你可能需要将gcc的路径添加到PATH变量中。 It should work like this:
它应该像这样工作:
Open up .bash_profile in a text editor. 在文本编辑器中打开.bash_profile。 (If you're using TextEdit, you can do this at the command line with "open -a /Applications/TextEdit.app ~/.bash_profile".) Add the line:
(如果您正在使用TextEdit,可以在命令行中使用“open -a /Applications/TextEdit.app~ / .bash_profile”执行此操作。)添加以下行:
export PATH="/usr/local/bin:$PATH" export PATH =“/ usr / local / bin:$ PATH”
to the file. 到文件。 Save the file and open up a new terminal, then type "echo $PATH" to see if it worked correctly.
保存文件并打开一个新终端,然后键入“echo $ PATH”以查看它是否正常工作。
EDIT: Someone else had the exact same output as you and managed to fix it by replacing his Eclipse version with an older one. 编辑:其他人拥有与您完全相同的输出,并设法通过将旧版本替换为旧版本来修复它。 You may try to use Helios instead of Indigo or Juno.
您可以尝试使用Helios而不是Indigo或Juno。 This is just a temporary solution until something better comes up (in case it really works).
这只是一个临时的解决方案,直到更好的东西出现(如果真的有效)。 I actually prefer Indigo and Helios over Juno, to be honest.
实际上,我实际上更喜欢Indigo和Helios而不是Juno。 In case you have any worries - Helios is the release from 2010 and still pretty good.
如果你有任何担忧 - Helios是从2010年发布的,仍然相当不错。
For cout - do you have #include ? 对于cout - 你有#include吗? Note that cout is a part of std namespace - you need to either qualify it or use "using" directive.
请注意,cout是std命名空间的一部分 - 您需要对其进行限定或使用“using”指令。
You have to alter ~/.bash_profile
, see below for the procedure: 你必须改变
~/.bash_profile
,参见下面的程序:
open terminal window 打开终端窗口
send cmd echo $PATH
, then copy the -bash output 发送cmd
echo $PATH
,然后复制-bash输出
touch ~/.bash_profile
touch ~/.bash_profile
open -a TextEdit.app ~/.bash_profile
open -a TextEdit.app ~/.bash_profile
PATH='paste the copied items from echo $PATH cmd a while a back'
PATH='paste the copied items from echo $PATH cmd a while a back'
$PATH
again. $PATH
。 my solution is 我的解决方案是
in preference-> c/c++ -> build->enviroment
add PATH= /usr/local/bin
在偏好中 - >
c/c++ -> build->enviroment
add PATH= /usr/local/bin
hope it is fine for you. 希望对你好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.