boost/unordered_set: mingw () 编译错误

发布于 2024-11-15 08:11:39 字数 1669 浏览 5 评论 0原文

我有一段使用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

对我来说,这似乎是一个与模板相关的问题;有什么建议吗?

谢谢你, Mattia


[编辑]

其他增强功能可用,例如词法转换

#include <boost/lexical_cast.hpp>

I have a piece of code that uses boost's unordered_set

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

It compiles and works fine with gcc under unix. When I try cross compiling with mingw32 (gmake 3.8.1) I get the following message:

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

To me it seems like a template related problem; any suggestions?

Thank you,
Mattia


[EDIT]

other boost functionalities are available, for example the lexical cast

#include <boost/lexical_cast.hpp>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞笑我太脆弱 2024-11-22 08:11:39

似乎某些 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 开发人员。

It seems that some typedef breaks the boost cstdint header, which looks like

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;

on my system. So, some hero probably defined "#define uint8_t" instead of "typedef ... uint8_t", and this code consequently breaks.

You might try to to modify your boost/config/platform/win32.hpp and, if that helps, report the bug to the mingw developers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文