C++ 将boost与数字配方3代码集成

C++ 将boost与数字配方3代码集成,c++,boost,numerical-methods,C++,Boost,Numerical Methods,当我同时使用nr3.h和boost库时,会出现一系列错误 我使用Ubuntu10.04和libboost1.40,代码来自(第三版) try.cc: #include "nr3.h" #include <boost/algorithm/string/predicate.hpp> int main(void) { return 0; } 更新: 我还把它贴在了nr.com论坛上(http://www.nr.com/forum/showthread.php?t=2148). 得到

当我同时使用nr3.h和boost库时,会出现一系列错误

我使用Ubuntu10.04和libboost1.40,代码来自(第三版)

try.cc:

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

int main(void) {
  return 0;
}
更新:
我还把它贴在了nr.com论坛上(http://www.nr.com/forum/showthread.php?t=2148). 得到的回答是,问题在于nr3.h为throw()创建了一个define宏。我仍然不确定什么是一个强有力的解决方案。

< P>快速进入NR3.H,并将C++关键字滥用宏“扔”到一个不冒犯的无C++关键字,如“ToSs”。尝试包含
nh3.h
在所有boost和system headers.hm之后,它起作用了:-)我替换了两行包含行。然而,它似乎不是一个健壮的解决方案。在某些情况下,NR3之后可能需要包含Boost,唯一的健壮的解决方案是获得NR上游,改变其代码以停止将C++关键字定义为宏,并开始使用适当的库前缀来代替。这可能是一个向后兼容的问题,但在这种情况下确实没有好的解决方案。此外,我建议不要直接使用本书中的NR代码进行任何与生产相关的操作。
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