【发布时间】:2011-06-15 14:56:23
【问题描述】:
我有一段代码使用了 boost 的 unordered_set
#include <boost/unordered_set.hpp>
boost::unordered_set<string> mySet(100);
它可以在 unix 下与 gcc 一起编译并正常工作。当我尝试使用 mingw32 (gmake 3.8.1) 进行交叉编译时,我收到以下消息:
In file included
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/functional/hash/detail/hash_float.hpp:17,
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/functional/hash/hash.hpp:15,
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/functional/hash.hpp:6,
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/unordered/unordered_set.hpp:17,
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/unordered_set.hpp:16,
from /mnt/VirtualBoxShare/percolator/src/ProteinProbEstimatorHelper.h:33,
from /mnt/VirtualBoxShare/percolator/src/ProteinProbEstimator.cpp:28:
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:105: error: expected unqualified-id before 'unsigned'
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:105: error: expected ';' before 'unsigned'
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:105: error: declaration does not declare anything
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:114: error: expected unqualified-id before 'unsigned'
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:114: error: expected ';' before 'unsigned'
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:114: error: declaration does not declare anything
对我来说,这似乎是一个与模板相关的问题;有什么建议吗?
谢谢, 马蒂亚
[编辑]
其他增强功能可用,例如词法转换
#include <boost/lexical_cast.hpp>
【问题讨论】:
-
什么版本的 MinGW 和 gcc?也许您可以使用 C++0x unordered_set 代替 boost 中的这个?
-
什么版本的Boost?你有
#include <string>吗?还有using std::string;还是using namespace std;? -
@Zuljin 抱歉,mingw32-boost-1.41.0 和 mingw32-gcc-c++-4.4.2。包含字符串标题,我正在使用 std::string.
标签: boost mingw unordered-set