G ++在Cygwin vs Linux下创建的可执行文件的默认文件扩展名 [英] Default file extension of the executable created by g++ under Cygwin vs Linux

查看:218
本文介绍了G ++在Cygwin vs Linux下创建的可执行文件的默认文件扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VisualStudio上完成了我的大部分工作,没有使用gcc或g ++的经验。当我试图编译一个(ex。aprogram.cpp)今天早上在我的电脑上使用cygwin,我得到了(aprogram.exe)当我试图编译同样的东西在我的Ubuntu框我有(aprogram)w / o任何扩展。我只是想知道有人是否足够告诉我为什么。这个问题只是出于好奇心。 :)

I've done most of my work on VisualStudio and don't have much experience with gcc or g++. When I tried to compile a (ex. aprogram.cpp) this morning on my pc using cygwin, I got (aprogram.exe) when I tried to compile the same thing on my Ubuntu box I got (aprogram) w/o any extension. I am just wondering if someone be kind enough to tell me why. This question is just out of curiosity. :)

提前感谢!

编辑:
(来自Jimmy的评论)
g ++下的Cygwin默认为.exe

(from Jimmy's comment) g++ under Cygwin defaults to .exe

推荐答案

这很容易:在UNIX上,您不需要任何steenkin的扩展。事实上,像.c这样的扩展只是一个方便的命名约定;与Windows不同,文件系统将文件名视为一个字符串,.c和所有。

That's easy: on UNIX, you don't need no steenkin' extensions. In fact, an "extension" like .c is just a convenient naming convention; unlike Windows, the file system sees the file name as one string, .c and all.

为了真正的程序没有 -o 标志。您的可执行文件将仍然显示---命名为可执行文件的默认名称: a.out

For a really good time, compile a C program with no -o flag at all. Your executable will still show up --- named the default name for executables: a.out.

这篇关于G ++在Cygwin vs Linux下创建的可执行文件的默认文件扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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