Boost mingw 链接错误

发布于 2024-12-17 16:37:21 字数 302 浏览 1 评论 0原文

我似乎在 Windows 上使用 mingw 链接到 boost 库时遇到问题。我在谷歌和 stackoverflow 上到处搜索,但没有一个答案解决了问题。

它找不到或链接到“-lboost_threads”。编译时出现“未定义错误”。

也许知道如何的人可以帮我解决这个问题。

在 Windows 上使用 boost v1.48 和 mingw。

编辑:

错误是“...mingw32/bin/ld.exe 找不到 -lboost_thread”,在这种情况下通常可能会出现这种情况。

谢谢。

I seem to have a problem linking to boost libs using mingw on windows. I search high and low on google and stackoverflow but none of the answers solved the problem.

It can't find or link to "-lboost_threads". Getting an "undefined error" when compiling.

Maybe someone who knows howto can help me solve it.

Using boost v1.48 and mingw on windows.

EDIT:

Error being "...mingw32/bin/ld.exe cannot find -lboost_thread", as it probably usually would in this case.

Thanks.

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

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

发布评论

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

评论(1

叫嚣ゝ 2024-12-24 16:37:21

链接器命令行参数 -lboost_thread 表示链接器应在其库路径(您可以使用 -Lpath 添加)中查找 boost_thread /to/library。它尝试在具有以下文件名之一的文件中查找库:

  • libboost_thread.a(GCC 类型存档库 - 这是您在本例中需要的) )
  • boost_thread.lib(MSVC 库 - 请注意,如果它们是 C 语言,而不是 C++ 语言,MinGW 可以链接它们))
  • 以及更多扩展(不相关)。

无论如何,此错误消息意味着链接器无法在包含路径中找到此类库。检查库文件所在位置(你应该知道);如果它位于编译器的 lib 文件夹中,那么它已经位于链接器可以找到它的位置。也许你把名字拼错了?否则添加适当的 -L 命令行参数,以便链接器知道在哪里查找文件。

(还有 boost_thread 或 boost_threads?)

The linker command line argument -lboost_thread means that the linker shall look boost_thread in its library paths (which you can add using -Lpath/to/library. It tries to find the library in a file with one of the following filenames:

  • libboost_thread.a (GCC-type archive library - this is what you need in this case)
  • boost_thread.lib (MSVC libs- note that MinGW can link them if they're in C, not C++))
  • and a couple more extensions (not relevant).

Anyway, this error message means that the linker cannot find such library in the include paths. Check where the library file is located (you should know that); if it's in your compiler's lib folder, then it's already in a place where your linker would find it. Maybe you've misspelled the name? Otherwise add an appropriate -L command line argument so that the linker would know where to look for the file.

(Also boost_thread or boost_threads?)

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