难道没有GCC g ++的工作? [英] Does g++ work without gcc?

查看:112
本文介绍了难道没有GCC g ++的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请问G ++编译不GCC或G ++只是翻译//包括旧G ++版本。

当我试图从源代码,我看到文件安装G ++


  

gcc.c


  / *默认prefixes附加到命令的名字。 * /的#ifndef STANDARD_EXEC_ preFIX
#定义STANDARD_EXEC_ preFIX在/ usr / local / lib目录/ gcc-
#ENDIF / *!定义STANDARD_EXEC_ preFIX * /

这是G ++ 1.4 // *

嗯,我知道C ++是带类的C我只是想知道,如果G ++可以编译C ++不GCC。


解决方案

随着近期 GCC GCC (实际上 CC1 这是由运行gcc )和 G ++ (实际上 cc1plus 其他GCC编译器,如) - 和等 gfortran 甚至 GDC ....-分享了很多(源)code一起组成:中间末端(其中,最优化发生)和后端。所不同的是仅将编译器(特定的唯一的层存在源语言),它是编译器的小于30%的前端层

您可以定制GCC编译器与插件或 MELT 。您的扩展将工作海合会内部重新presentations(GIMPLE-S)和编译C,C ++,Ada语言,Fortran语言等时会工作......记住的 GCC 的手段的 GNU编译器集合的今天

其实, GCC 程序能够编译C ++源$ C ​​$ C(同样地 G ++ 可以编译C或Fortran的code)。然而,它们不连接的相同的库

通过 -v 标志的 GCC G ++ 命令,了解他们正在运行的。


下面是两个(矿)[CC-BY-SA]图片-explaing GCC和放大器;熔融说明这一点。

的三个层次 - 前年底,中端,编译器的背端值:

与你的插件,或 MELT 元插件

与简化: CC1 cc1plus 正在生成汇编文件,然后由<翻译code>为按 GCC启动 G ++

的内部的另一个视图 CC1 cc1plus

这产生了一些汇编code

Does G++ compile without GCC or G++ is just translator // Including old g++ version.

when i was trying to install g++ from source i saw file

gcc.c

/* Default prefixes to attach to command names.  */

#ifndef STANDARD_EXEC_PREFIX
#define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-"
#endif /* !defined STANDARD_EXEC_PREFIX */

//from g++1.4*

Well i know that c++ is c with classes i just wanted to know if the g++ can compile c++ without gcc .

解决方案

With a recent GCC, gcc (actually cc1 which is run by gcc) and g++ (actually cc1plus) -and so on for other GCC compilers, e.g. gfortran or even gdc ....- share a lot of (source) code together: the middle-end (where most optimizations happen) and the back-end. The difference is only the front-end layer of the compiler (the only layer being source language specific) which is less than 30% of the compiler.

You could customize the GCC compiler with plugins or with MELT. Your extensions would work on GCC internal representations (Gimple-s) and would work when compiling C, C++, Ada, Fortran, etc... Remember that GCC means Gnu Compiler Collection today

Actually the gcc program is able to compile C++ source code (and likewise g++ can compile C or Fortran code). However, they are not linking the same libraries.

Pass the -v flag to the gcc or g++ command to understand what they are running.


Here are two (mine) [CC-BY-SA] pictures -explaing GCC & MELT- illustrating this.

The three layers -front-end, middle-end, back-end- of the compiler:

with your plugin, or the MELT meta-plugin

with a simplification: cc1 or cc1plus are generating assembler files, which is then translated by as started by gcc or g++

and

another view of the internals of cc1 or cc1plus,

which generates some assembler code

这篇关于难道没有GCC g ++的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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