哪个MinGW文件用作C ++编译器 [英] Which MinGW file to use as a C++ compiler

查看:473
本文介绍了哪个MinGW文件用作C ++编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了MinGW,在bin文件夹中,我可以看到7个编译我的程序的.exe文件:


  1. c ++。exe

  2. g ++。exe

  3. mingw32-c ++。exe

  4. mingw32-g ++。exe


  5. mingw32-gcc.exe

  6. mingw32-gcc-4.4.1.exe

我的小程序(testprog.cpp)正确编译每个程序; a.exe 文件在bin文件夹中生成并且正确运行。



它们之间有什么区别我应该使用哪一个?
此外,在每次成功编译时,我可以自动将输出文件的名称从a.exe更改为testprog.exe?

解决方案

很可能他们都是一样的;彼此的精确副本或符号链接。尝试使用 - 版本标志,看看你有什么。在我的MingGW安装在这里,每个二进制文件不同(检查与 diff ),但他们都输出相同的版本信息(除了第一位,这是文件名):

  gcc.exe(GCC)3.4.5(mingw- vista special r3)
版权所有)2004 Free Software Foundation,Inc.
这是免费软件;请参阅复制条件的来源。有NO
保修;甚至不适用于适销性或特定用途的适用性。

使用 -o 标志更改输出文件名:

  gcc -o testprog.exe testprog.cpp 
pre>

I have just installed MinGW and in the bin folder I can see 7 .exe files that compile my program:

  1. c++.exe
  2. g++.exe
  3. mingw32-c++.exe
  4. mingw32-g++.exe
  5. gcc.exe
  6. mingw32-gcc.exe
  7. mingw32-gcc-4.4.1.exe

My small program (testprog.cpp) compiles correctly with each of them; the a.exe file is generated in the bin folder and it runs correctly.

What's the difference between them and which one should I use? Also, what can I do to change the name of the output file from a.exe to testprog.exe automatically upon each successful compile?

解决方案

It's quite possible that they are all the same; either exact copies or symbolic links to one another. Try using the --version flag on each to see what you've got. On my MingGW installation here, each of those binaries differs (checked with diff), but they all output the same version information (with the exception of the first bit, which is the filename):

gcc.exe (GCC) 3.4.5 (mingw-vista special r3)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Use the -o flag to change the output file name:

gcc -o testprog.exe testprog.cpp

这篇关于哪个MinGW文件用作C ++编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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