Eclipse & C/C++ - 我需要单独安装编译器吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1943753/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 21:40:10  来源:igfitidea点击:

Eclipse & C/C++ - do I need to install a compiler separately?

c++ceclipse

提问by geek

I'm starting to learn C, and installed the eclipse plugin for C/C++ development (the CDT plugin). I'm testing the setup with a hello world program, but it looks like the eclipse C plugin (CDT) doesn't have a compiler built in. I thought eclipse plugins were usually self-sufficient? Do I need to install a compiler separately to complete my c setup, or how do I get it to compile from within eclipse.

我开始学习 C,并安装了用于 C/C++ 开发的 eclipse 插件(CDT 插件)。我正在使用 hello world 程序测试设置,但看起来 eclipse C 插件 (CDT) 没有内置编译器。我认为 eclipse 插件通常是自给自足的?我是否需要单独安装编译器来完成我的 c 设置,或者我如何从 eclipse 中编译它。

I did the usual: created a new c project in the eclipse workspace, created a new hello.c file that looks like this:

我做了通常的事情:在 eclipse 工作区中创建了一个新的 c 项目,创建了一个新的 hello.c 文件,如下所示:

/*
 * hello.c
 *
 *  Created on: 2009-12-21
 *  Author: geek
 */

main(){
 printf("hello world\n");
}

Edit: OS is windows VistaCan someone suggest a compiler that's known to play nice with eclipse (or a tutorial that you've used yourself to get this sorted out)

编辑:操作系统是 windows Vista有人可以推荐一个已知可以很好地与 eclipse 配合使用的编译器(或者你自己用来解决这个问题的教程)

采纳答案by goatlinks

On OS X, you can install Xcode from your installation CD to get the gcc compiler, or in [Li|U]nix you probably already have gcc installed. If you're on Windows check out MinGW. Thats a free C/C++ compiler based on gcc.

在 OS X 上,您可以从安装 CD 安装 Xcode 以获取 gcc 编译器,或者在 [Li|U]nix 中,您可能已经安装了 gcc。如果您使用的是 Windows,请查看MinGW。那是一个基于 gcc 的免费 C/C++ 编译器。

回答by Greg Hewgill

Probably the easiest way to get started with C programming on Windows is to install the free Visual C++ Express Edition. It comes with a compiler built-in, and unless you reallywant to use Eclipse for some reason, it's probably the least friction option.

在 Windows 上开始使用 C 编程的最简单方法可能是安装免费的Visual C++ Express Edition。它带有一个内置的编译器,除非您出于某种原因真的想使用 Eclipse,否则它可能是摩擦最小的选项。

回答by Firas Assaad

You need to have a compiler installed separately. Here is a CDT/compiler installation guidefor different operating systems.

您需要单独安装编译器。这是针对不同操作系统的CDT/编译器安装指南