интеграция повышения с числовыми рецептами 3 кода - PullRequest
0 голосов
/ 03 октября 2011

Я получаю кучу ошибок, когда использую nr3.h и библиотеку boost.

Я использую Ubuntu 10.04 с libboost1.40 и кодом из http://www.nr.com/ (3-е издание)

try.cc:

#include "nr3.h"
#include <boost/algorithm/string/predicate.hpp>

int main(void) {
  return 0;
}

Я компилирую код "g ++ try.cc" и получаю ошибки. если я закомментирую строку nr3.h или строку , код скомпилируется нормально.

вот ошибки:

In file included from /usr/include/boost/assert.hpp:36,
                 from /usr/include/boost/range/iterator_range.hpp:31,
                 from /usr/include/boost/range/as_literal.hpp:22,
                 from /usr/include/boost/algorithm/string/predicate.hpp:19,
                 from boostnrexample.cc:2:
/usr/include/assert.h: In function ‘void __assert_fail(const char*, const char*, unsigned int, const char*)’:
/usr/include/assert.h:73: error: expected primary-expression before ‘,’ token
/usr/include/assert.h: At global scope:
/usr/include/assert.h:73: error: declaration does not declare anything
/usr/include/assert.h: In function ‘void __assert_perror_fail(int, const char*, unsigned int, const char*)’:
/usr/include/assert.h:79: error: expected primary-expression before ‘,’ token
/usr/include/assert.h: At global scope:
/usr/include/assert.h:79: error: declaration does not declare anything
/usr/include/assert.h: In function ‘void __assert(const char*, const char*, int)’:
/usr/include/assert.h:85: error: expected primary-expression before ‘,’ token
/usr/include/assert.h: At global scope:
/usr/include/assert.h:85: error: declaration does not declare anything
In file included from /usr/include/c++/4.4/x86_64-linux-gnu/bits/messages_members.h:37,
                 from /usr/include/c++/4.4/bits/locale_facets_nonio.h:1905,
                 from /usr/include/c++/4.4/locale:43,
                 from /usr/include/boost/algorithm/string/compare.hpp:15,
                 from /usr/include/boost/algorithm/string/predicate.hpp:22,
                 from boostnrexample.cc:2:
/usr/include/libintl.h: In function ‘char* gettext(const char*)’:
/usr/include/libintl.h:41: error: expected primary-expression before ‘,’ token
/usr/include/libintl.h: At global scope:
/usr/include/libintl.h:41: error: declaration does not declare anything
/usr/include/libintl.h: In function ‘char* dgettext(const char*, const char*)’:
/usr/include/libintl.h:46: error: expected primary-expression before ‘,’ token
/usr/include/libintl.h: At global scope:
/usr/include/libintl.h:46: error: declaration does not declare anything
/usr/include/libintl.h: In function ‘char* __dgettext(const char*, const char*)’:
/usr/include/libintl.h:48: error: expected primary-expression before ‘,’ token
/usr/include/libintl.h: At global scope:
/usr/include/libintl.h:48: error: declaration does not declare anything
/usr/include/libintl.h: In function ‘char* dcgettext(const char*, const char*, int)’:
/usr/include/libintl.h:54: error: expected primary-expression before ‘,’ token
/usr/include/libintl.h: At global scope:
/usr/include/libintl.h:54: error: declaration does not declare anything
/usr/include/libintl.h: In function ‘char* __dcgettext(const char*, const char*, int)’:
/usr/include/libintl.h:57: error: expected primary-expression before ‘,’ token
/usr/include/libintl.h: At global scope:
/usr/include/libintl.h:57: error: declaration does not declare anything
/usr/include/libintl.h: In function ‘char* ngettext(const char*, const char*, long unsigned int)’:
/usr/include/libintl.h:64: error: expected primary-expression before ‘,’ token
/usr/include/libintl.h: At global scope:
/usr/include/libintl.h:64: error: declaration does not declare anything
/usr/include/libintl.h: In function ‘char* dngettext(const char*, const char*, const char*, long unsigned int)’:
/usr/include/libintl.h:70: error: expected primary-expression before ‘,’ token
/usr/include/libintl.h: At global scope:
/usr/include/libintl.h:70: error: declaration does not declare anything
/usr/include/libintl.h: In function ‘char* dcngettext(const char*, const char*, const char*, long unsigned int, int)’:
/usr/include/libintl.h:77: error: expected primary-expression before ‘,’ token
/usr/include/libintl.h: At global scope:
/usr/include/libintl.h:77: error: declaration does not declare anything
/usr/include/libintl.h: In function ‘char* textdomain(const char*)’:
/usr/include/libintl.h:83: error: expected primary-expression before ‘,’ token
/usr/include/libintl.h: In function ‘char* bindtextdomain(const char*, const char*)’:
/usr/include/libintl.h:88: error: expected primary-expression before ‘,’ token
/usr/include/libintl.h: In function ‘char* bind_textdomain_codeset(const char*, const char*)’:
/usr/include/libintl.h:93: error: expected primary-expression before ‘,’ token

Обновление: я также разместил его на форуме nr.com (http://www.nr.com/forum/showthread.php?t=2148). и получил ответ, что проблема в том, что nr3.h создал макрос для throw (). Я до сих пор не уверен, что может быть надежным решением.

1 Ответ

2 голосов
/ 29 января 2013

Быстрое решение состоит в том, чтобы перейти к nr3.h и заменить макрос злоупотребления ключевым словом C ++ «throw» на безобидное ключевое слово C ++, например «toss».

...