首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >macros上的C++新手问题:使用f2c (Fortran编译器)编译--由于宏而产生的错误?

macros上的C++新手问题:使用f2c (Fortran编译器)编译--由于宏而产生的错误?
EN

Stack Overflow用户
提问于 2010-11-29 21:54:26
回答 2查看 1.5K关注 0票数 0

我是一个C++新手,试图在MacOSX上编译需要f2c (它是用于Fortran)的代码。我有点力不从心,非常感谢任何人的帮助!

当我做"make“的时候,我得到了很多错误。我的猜测是这些都与f2c有关。f2c中可能存在宏,这对Mac来说是个问题。外面有没有人遇到过这样的事情?有解决方案吗?

以下是错误的示例:

代码语言:javascript
复制
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
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2010-11-29 21:58:41

似乎f2c生成的一些宏的名称已经由您的C++定义。

票数 0
EN

Stack Overflow用户

发布于 2010-11-29 21:58:44

看起来你使用的是雪豹(OSX10.6),使用的是默认的gcc 4.2工具链。试着使用更老的gcc 4.0工具链,它也是可用的。

代码语言:javascript
复制
$ cd /usr/bin
$ sudo ln -fs gcc-4.0 gcc
$ sudo ln -fs g++-4.0 g++

如果这不起作用,您可以恢复上面的代码,如下所示:

代码语言:javascript
复制
$ cd /usr/bin
$ sudo ln -fs gcc-4.2 gcc
$ sudo ln -fs g++-4.2 g++
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4304397

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档