0

ブーストの 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>
4

1 に答える 1

1

一部のtypedefがブースト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;

私のシステムで。したがって、一部のヒーローはおそらく「typedef ...uint8_t」ではなく「#defineuint8_t」を定義し、その結果、このコードは壊れます。

boost / config / platform / win32.hppを変更してみて、それが役立つ場合は、バグをmingw開発者に報告してください。

于 2011-07-16T09:44:17.877 に答える