如何在Unix控制台/ Mac的终端运行C / C ++? [英] How to run C/C++ in a Unix console/Mac terminal?

查看:170
本文介绍了如何在Unix控制台/ Mac的终端运行C / C ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能在UNIX控制台或Mac终端运行C或C ++?

How can I run C or C++ in Unix console or a Mac terminal?

(我知道它,忘记它,并再次重新学习它。时间把它写下来。)

(I know it, forgets it and relearn it again. Time to write it down.)

推荐答案

如果它是一个简单的单源程序:

If it is a simple single source program:

make foo

源代码文件是foo.c的或Foo.cpp中,等等。

where the source file is foo.c or foo.cpp, etc.

你甚至需要一个makefile。使有足够内置的规则来构建你的源文件到同一名称,减去扩展的可执行文件。

You dont even need a makefile. Make has enough built-in rules to build your source file into an executable of the same name, minus extension.

这篇关于如何在Unix控制台/ Mac的终端运行C / C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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