Проблема новичка C ++ в Mac OSX: компиляция с помощью f2c (компилятор Fortran) - ошибки из-за макросов? - PullRequest
0 голосов
/ 29 ноября 2010

Я новичок в 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

Ответы [ 2 ]

0 голосов
/ 29 ноября 2010

Похоже, что вы используете 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++
0 голосов
/ 29 ноября 2010

Кажется, что f2c генерирует некоторые макросы, имена которых уже определены вашим C ++.

...