4

为了在 Windows 下使用 Visual Studio 2008 编译 C++ Net Lib 项目,我需要禁用概念检查(请参阅此线程:https ://groups.google.com/forum/#!msg/cpp-netlib/G-hM25EnCWA/ gdsHBaVfmggJ )

编译在 Release 中有效,但在 Debug 中无效(.cpp 编译失败)

我通过在包含客户端标头之前定义 NDEBUG 来管理标头的编译成功。但是,当链接器想要链接到 Boost.system 库的发布版本时,这会失败:而我正在使用调试。我收到此错误:

6>链接:致命错误LNK1104:无法打开文件'libboost_system-vc90-mt-1_50.lib'

我想用 BOOST_SYSTEM_NO_LIB 防止这种情况,但它仍然想链接到发布版本(我的项目链接到 'libboost_system-vc90-mt-gd-1_50.lib' (调试库))

在包含标题之前是否有一个简单的宏要定义,它将禁用 Boost.ConceptCheck 的东西,就像它在 Release 构建中所做的那样?我没有在 Boost 文档中找到任何信息,也没有在头文件本身中找到任何信息。

非常感谢

盖坦

4

1 回答 1

3

这是我要做的:

#include <boost/concept/assert.hpp>
// redefine concept assert, suppress the warning etc.
#undef BOOST_CONCEPT_ASSERT
#define BOOST_CONCEPT_ASSERT(Model)
#include <boost/concept_check.hpp>

struct not_an_iterator
{};


int main()
{
  BOOST_CONCEPT_ASSERT((InputIterator<not_an_iterator>));
  return 0;
}

这将使concept_assert 什么也不做,但我担心它不会阻止您的链接器错误,这看起来很模糊。

于 2012-12-18T10:37:20.043 回答