问题描述
||
我有一段使用boost's 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>
解决方法
似乎有些typedef破坏了boost cstdint标头,看起来像
103 using ::int8_t;
104 using ::int_least8_t;
105 using ::int_fast8_t;
106 using ::uint8_t;
107 using ::uint_least8_t;
108 using ::uint_fast8_t;
在我的系统上。因此,某些英雄可能定义了\“#define uint8_t \”而不是\“ typedef ... uint8_t \”,因此该代码中断了。
您可能会尝试修改boost / config / platform / win32.hpp,如果有帮助,请将该错误报告给mingw开发人员。