我是一个C ++新手试图在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
答案 0 :(得分:0)
似乎f2c
生成了一些宏,这些宏的名称已经由C ++定义。
答案 1 :(得分:0)
使用默认的gcc 4.2工具链看起来像是在Snow Leopard(OS X 10.6)上。尝试使用旧版的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++