我有一段代码使用了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>
答案 0 :(得分:1)
似乎某些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开发人员。