简体   繁体   English

在 Mac OS X 上编辑 C++ 的好方法是什么?

[英]What is a good way to edit C++ on Mac OS X?

I am a first year Comp.我是第一年的 Comp。 Sci.科学。 student and am looking for the best way to develop C++ on a Mac.学生,我正在寻找在 Mac 上开发 C++ 的最佳方式。 I have Xcode and Textmate.我有 Xcode 和 Textmate。

What are the benefits/negatives of each?每个的好处/坏处是什么? Are there any better ones?有没有更好的?

I am not a fan of having to use a whole project to run programs with Xcode.我不喜欢必须使用整个项目来使用 Xcode 运行程序。 Is this the only way to do it, or am I mistaken?这是唯一的方法,还是我错了?

Also, is there a way to change the default text that is included in a .cpp file in xcode?另外,有没有办法更改 xcode 中 .cpp 文件中包含的默认文本?

What is a good way to edit C++ on Mac OS X?在 Mac OS X 上编辑 C++ 的好方法是什么?

With your head.用你的头。

Try both.两个都试试。 Text editors are a matter of personal taste.文本编辑器是个人品味的问题。 See the flames over vim vs. emacs that make the Sun look pale.看看vimemacs上的火焰让太阳看起来苍白。

The only one that can tell you what is the best text editor for you , is you .唯一可以告诉您什么是最适合您的文本编辑器就是您自己

http://code.google.com/p/macvim/ http://code.google.com/p/macvim/

I would dig in and learn vim (or emacs if you really want to).我会深入学习 vim(或者 emacs,如果你真的想的话)。

EDIT: You've got 4+ years ahead of you in CS.编辑:您在 CS 方面领先 4 年以上。 I really would suggest learning vim or emacs especially when you are still in university.我真的建议你学习 vim 或 emacs,尤其是当你还在上大学的时候。

With Xcode you can edit each file separately, without needing them to belong to a project.使用 Xcode,您可以单独编辑每个文件,而无需它们属于一个项目。 Also, you can look in /Developer/Library/Xcode/File Templates for the templates used by Xcode;此外,您可以在 /Developer/Library/Xcode/File Templates 中查看 Xcode 使用的模板; feel free to take a whack at them as you find suitable.当您觉得合适时,请随意对它们进行打击。

I'm a huge fan of textmate.我是 textmate 的忠实粉丝。 It gives you a lot of power but doesn't get in your way.它给了你很大的力量,但不会妨碍你。 You could also try Eclipse for C/C++你也可以试试Eclipse for C/C++

I almost exclusively use Textmate, but to be fair the decision to switch to Textmate (coming from codewarrior in OS 9 days), was mainly because the XCode editor (then named ProjectBuilder) was annoyingly slow at editing larger files.我几乎只使用 Textmate,但公平地说,决定切换到 Textmate(来自 OS 9 天的 codewarrior),主要是因为 XCode 编辑器(当时命名为 ProjectBuilder)在编辑较大的文件时速度非常慢。

I'm sure that changed a lot over the years, but I see no reason to switch so I don't.我确信这些年来变化很大,但我认为没有理由转换,所以我没有。

That said, one thing where XCode really outshines Textmate is the integration of a debugger, when you're just starting to learn, I think having an integrated debugger will help you quickly understand what's going on with your code, and will be a great advantage...也就是说,XCode 真正胜过 Textmate 的一件事是调试器的集成,当你刚开始学习时,我认为拥有一个集成的调试器将帮助你快速了解你的代码发生了什么,这将是一个很大的优势...

If you've got Textmate, just try em both for a few months, you're a student anyway, you should have plenty of time如果你有 Textmate,就都试试几个月吧,反正你是学生,你应该有足够的时间

Netbeans is free, has great auto-completion for C++, Java and others. Netbeans 是免费的,对 C++、Java 和其他语言有很好的自动完成功能。 It's also cross-platform.它也是跨平台的。

http://www.netbeans.org/downloads/ http://www.netbeans.org/downloads/

I am not a fan of having to use a whole project to run programs with Xcode.我不喜欢必须使用整个项目来使用 Xcode 运行程序。 Is this the only way to do it, or am I mistaken?这是唯一的方法,还是我错了?

Because MacOS X is built on top of Unix you have many development tools available to you that lie outside of XCode.因为 MacOS X 建立在 Unix 之上,所以您可以使用许多位于 XCode 之外的开发工具。 Most notably with a good Terminal application you can develop directly with gcc, bypassing XCode altogether.最值得注意的是,有了一个好的终端应用程序,您可以直接使用 gcc 进行开发,完全绕过 XCode。 In that case I'd recommend finding a source editor you're comfortable with, such as TextMate or one of the others recommended here.在这种情况下,我建议您找到一个您喜欢的源代码编辑器,例如 TextMate 或此处推荐的其他编辑器之一。 Using gcc directly gives you the rapid turnaround with little overhead you seem to be looking for.直接使用 gcc 可以让您快速周转,而且您似乎正在寻找的开销很小。

I'm a huge fan of emacs, because:我是 emacs 的忠实粉丝,因为:

1) It's extensible. 1)它是可扩展的。 Thousands of languages are supported, you have modes for editing XML, HTML, etc. 2) It's highly configurable.支持数以千计的语言,您有编辑 XML、HTML 等的模式。2) 高度可配置。 You can set your own key bindings, change indentation, etc. 3) It's powerful.您可以设置自己的键绑定、更改缩进等。 3) 它功能强大。 It integrates easily with compilers, debuggers, it makes text editing really quick.它可以轻松地与编译器、调试器集成,使文本编辑变得非常快速。

You can check vi, textmate or xcode too.您也可以检查 vi、textmate 或 xcode。 They're all great editors.他们都是很棒的编辑。 It all comes to which one works better for you.这一切都取决于哪一种更适合您。

I quite like Xcode .我非常喜欢Xcode I'm not sure why you ruled it out.我不确定你为什么排除它。 It's really not that complicated.真的没有那么复杂。

I recently used SublimeText it is nice and fast.我最近使用了 SublimeText,它既好又快。 Give it a try.试一试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM