使用f2c(Fortran编译器)编译——宏导致的错误?

问题描述 投票:0回答:2

我正在尝试在 MacOSX 上编译需要 f2c 的代码(适用于 Fortran)。 我有点超出我的深度,希望得到任何帮助!

当我“make”时,我遇到很多错误。 我猜测这些都和f2c有关。 f2c 中的宏可能对 Mac 来说是个问题。 有没有人遇到过这种事情? 有解决办法吗?

以下是错误示例:

In file included from /usr/include/c++/4.2.1/ios:47,
                 from /usr/include/c++/4.2.1/istream:44,
                 from /usr/include/c++/4.2.1/fstream:45,
/usr/include/c++/4.2.1/bits/localefwd.h:58:34: error: macro "isspace" passed 2 arguments, but takes just 1
/usr/include/c++/4.2.1/bits/localefwd.h:82:34: error: macro "isdigit" passed 2 arguments, but takes just 1
In file included from /usr/include/c++/4.2.1/bits/basic_ios.h:44,
                 from /usr/include/c++/4.2.1/ios:50,
                 from /usr/include/c++/4.2.1/istream:44,
                 from /usr/include/c++/4.2.1/fstream:45,
/usr/include/c++/4.2.1/bits/locale_facets.h:4611:44: error: macro "isspace" passed 2 arguments, but takes just 1
/usr/include/c++/4.2.1/bits/locale_facets.h:4647:44: error: macro "isdigit" passed 2 arguments, but takes just 1
In file included from /usr/include/c++/4.2.1/iosfwd:47,
                 from /usr/include/c++/4.2.1/bits/stl_algobase.h:70,
                 from /usr/include/c++/4.2.1/algorithm:65,
/usr/include/c++/4.2.1/cctype:70: error: ‘::isalnum’ has not been declared
/usr/include/c++/4.2.1/cctype:71: error: ‘::isalpha’ has not been declared
/usr/include/c++/4.2.1/cctype:72: error: ‘::iscntrl’ has not been declared
/usr/include/c++/4.2.1/cctype:73: error: ‘::isdigit’ has not been declared
/usr/include/c++/4.2.1/cctype:74: error: ‘::isgraph’ has not been declared
/usr/include/c++/4.2.1/cctype:75: error: ‘::islower’ has not been declared
/usr/include/c++/4.2.1/cctype:76: error: ‘::isprint’ has not been declared
/usr/include/c++/4.2.1/cctype:77: error: ‘::ispunct’ has not been declared
/usr/include/c++/4.2.1/cctype:78: error: ‘::isspace’ has not been declared
/usr/include/c++/4.2.1/cctype:79: error: ‘::isupper’ has not been declared
/usr/include/c++/4.2.1/cctype:80: error: ‘::isxdigit’ has not been declared
/usr/include/c++/4.2.1/cctype:81: error: ‘::tolower’ has not been declared
/usr/include/c++/4.2.1/cctype:82: error: ‘::toupper’ has not been declared
In file included from /usr/include/wchar.h:114,
                 from /usr/include/c++/4.2.1/cwchar:55,
                 from /usr/include/c++/4.2.1/bits/postypes.h:46,
                 from /usr/include/c++/4.2.1/iosfwd:49,
                 from /usr/include/c++/4.2.1/bits/stl_algobase.h:70,
                 from /usr/include/c++/4.2.1/algorithm:65,
/usr/include/_wctype.h: In function ‘int iswalnum(wint_t)’:
/usr/include/_wctype.h:74: error: ‘_CTYPE_A’ was not declared in this scope
/usr/include/_wctype.h:74: error: ‘_CTYPE_D’ was not declared in this scope
/usr/include/_wctype.h:74: error: ‘__istype’ was not declared in this scope
/usr/include/_wctype.h: In function ‘int iswalpha(wint_t)’:
/usr/include/_wctype.h:80: error: ‘_CTYPE_A’ was not declared in this scope
/usr/include/_wctype.h:80: error: ‘__istype’ was not declared in this scope
/usr/include/_wctype.h: In function ‘int iswcntrl(wint_t)’:
/usr/include/_wctype.h:86: error: ‘_CTYPE_C’ was not declared in this scope
/usr/include/_wctype.h:86: error: ‘__istype’ was not declared in this scope
/usr/include/_wctype.h: In function ‘int iswctype(wint_t, wctype_t)’:
/usr/include/_wctype.h:92: error: ‘__istype’ was not declared in this scope
/usr/include/_wctype.h: In function ‘int iswdigit(wint_t)’:
/usr/include/_wctype.h:98: error: ‘_CTYPE_D’ was not declared in this scope
/usr/include/_wctype.h:98: error: ‘__isctype’ was not declared in this scope
/usr/include/_wctype.h: In function ‘int iswgraph(wint_t)’:
/usr/include/_wctype.h:104: error: ‘_CTYPE_G’ was not declared in this scope
/usr/include/_wctype.h:104: error: ‘__istype’ was not declared in this scope
/usr/include/_wctype.h: In function ‘int iswlower(wint_t)’:
/usr/include/_wctype.h:110: error: ‘_CTYPE_L’ was not declared in this scope
/usr/include/_wctype.h:110: error: ‘__istype’ was not declared in this scope
/usr/include/_wctype.h: In function ‘int iswprint(wint_t)’:
/usr/include/_wctype.h:116: error: ‘_CTYPE_R’ was not declared in this scope
/usr/include/_wctype.h:116: error: ‘__istype’ was not declared in this scope
/usr/include/_wctype.h: In function ‘int iswpunct(wint_t)’:
/usr/include/_wctype.h:122: error: ‘_CTYPE_P’ was not declared in this scope
/usr/include/_wctype.h:122: error: ‘__istype’ was not declared in this scope
/usr/include/_wctype.h: In function ‘int iswspace(wint_t)’:
/usr/include/_wctype.h:128: error: ‘_CTYPE_S’ was not declared in this scope
/usr/include/_wctype.h:128: error: ‘__istype’ was not declared in this scope
/usr/include/_wctype.h: In function ‘int iswupper(wint_t)’:
/usr/include/_wctype.h:134: error: ‘_CTYPE_U’ was not declared in this scope
/usr/include/_wctype.h:134: error: ‘__istype’ was not declared in this scope
/usr/include/_wctype.h: In function ‘int iswxdigit(wint_t)’:
/usr/include/_wctype.h:140: error: ‘_CTYPE_X’ was not declared in this scope
/usr/include/_wctype.h:140: error: ‘__isctype’ was not declared in this scope
/usr/include/_wctype.h: In function ‘wint_t towlower(wint_t)’:
/usr/include/_wctype.h:146: error: ‘__tolower’ was not declared in this scope
/usr/include/_wctype.h: In function ‘wint_t towupper(wint_t)’:
/usr/include/_wctype.h:152: error: ‘__toupper’ was not declared in this scope
c++ compilation
2个回答
-1
投票

看起来

f2c
生成了一些宏,其名称已经由你的C++定义了。


-1
投票

看起来您在 Snow Leopard (OS X 10.6) 上使用默认的 gcc 4.2 工具链。尝试使用旧版 gcc 4.0 工具链,该工具链也可用。

$ cd /usr/bin
$ sudo ln -fs gcc-4.0 gcc
$ sudo ln -fs g++-4.0 g++

如果这没有帮助,您可以按如下方式恢复上述内容:

$ cd /usr/bin
$ sudo ln -fs gcc-4.2 gcc
$ sudo ln -fs g++-4.2 g++
© www.soinside.com 2019 - 2024. All rights reserved.