OS X Yosemite gcc无法识别的命令行选项' mdll'在brew安装gcc之后

时间:2015-05-22 05:39:49

标签: c++ macos gcc homebrew yosemite

我使用brew安装了gcc,因为我需要安装brew的Fortran软件包。似乎brew install gcc安装的gcc包不支持mdll标志。如何安装正确版本的Fortran和gcc?

$ which gcc
/usr/local/bin/gcc

$ gcc --version
gcc (GCC) 4.9.2 20141029 (prerelease)
Copyright (C) 2014 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.

$ gcc -mdll
gcc: error: unrecognized command line option ‘-mdll’
gcc: fatal error: no input files
compilation terminated.

1 个答案:

答案 0 :(得分:1)

根据gcc(1)联机帮助页:

-mdll
  This option is available for Cygwin and MinGW targets. It
  specifies that a DLL---a dynamic link library---is to be generated,
  enabling the selection of the required runtime startup object and
  entry point.

由于OS X不是Cygwin或MinGW,因此可以安全地假设GCC的任何版本都不会在OS X上启用它。

如果您正在尝试构建动态链接对象(UNIX术语中的“共享对象”),请查看-dynamic / -dynamiclib标志。它们似乎是OS X的粗略等价物。