2011-06-15 10 views
0

私はそれをコンパイルし、UNIXでgccでうまく動作しブーストのunordered_setブースト/ unordered_set:mingwのでコンパイルエラー()

#include <boost/unordered_set.hpp> 
boost::unordered_set<string> mySet(100); 

を使用するコードの部分を持っています。私は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

MinGWとgccのどのバージョンですか?おそらく、あなたはC++ 0x unordered_setをboostの代わりに使うことができますか? – Zuljin

+0

Boostのどのバージョンですか?あなたは '#include 'を持っていますか?そして 'std :: string;を使うか、' using namespace std; '? – ildjarn

+0

@Zuljin申し訳ありません、mingw32-boost-1.41.0とmingw32-gcc-C++ - 4.4.2。文字列ヘッダがインクルードされ、std :: stringを使用しています。 –

答えて

1

は、いくつかのtypedefがブーストcstdintを破るようだたとえば、[EDIT]

他のブースト機能が用意されてい


、 マティア

をありがとう見た目は

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"の代わりに "#define uint8_t"と定義されているので、このコードは結果的に壊れます。

boost/config/platform/win32.hppを変更しようとすると、mingw開発者にバグを報告することができます。

+0

あなたはそれについてとても正しいです。私のプロジェクトでは、同じことをした "ヒーロー"が見つかりました: '' #define uint8_t unsigned char'' – Krypton

関連する問題