【问题标题】:CodeBlocks compile program for 32bit computerCodeBlocks 为 32 位计算机编译程序
【发布时间】:2020-10-09 04:32:51
【问题描述】:

我正在尝试使用添加 -m32 参数的 CodeBlock 默认 MinGW 编译器为 32 位系统编译我的代码,但我遇到了很多错误:

||=== Build: Debug in cONfuSioN (compiler: GNU GCC Compiler) ===|
ld.exe||cannot find -lstdc++|
ld.exe||cannot find -lmingw32|
ld.exe||cannot find -lgcc|
ld.exe||cannot find -lgcc_eh|
ld.exe||cannot find -lmoldname|
ld.exe||cannot find -lmingwex|
ld.exe||cannot find -lmsvcrt|
ld.exe||cannot find -lpthread|
ld.exe||cannot find -ladvapi32|
ld.exe||cannot find -lshell32|
ld.exe||cannot find -luser32|
ld.exe||cannot find -lkernel32|
ld.exe||cannot find -liconv|
ld.exe||cannot find -lmingw32|
ld.exe||cannot find -lgcc|
ld.exe||cannot find -lgcc_eh|
ld.exe||cannot find -lmoldname|
ld.exe||cannot find -lmingwex|
ld.exe||cannot find -lmsvcrt|
||error: ld returned 1 exit status|
||=== Build failed: 20 error(s), 0 warning(s) (0 minute(s), 6 second(s)) ===|

编辑:我修复了

【问题讨论】:

  • 是的,所以它几乎找不到任何它需要构建的文件。
  • 我该怎么办?我以为 MinGW 提供了编译 32 位程序所需的所有东西
  • 问题很可能不是MinGW。这是 Code::Blocks 认为所有这些文件所在的位置。
  • 或者构建文件认为的位置。请注意,ld.exe(MinGW 的链接器)是报告所有问题的程序。
  • 回滚。本网站采用问答形式(每个问题一个问题),如果您有新问题,请发布新问题

标签: c++ compiler-errors g++ codeblocks 32bit-64bit


【解决方案1】:

mingw.org 和 mingw-w64 的大多数版本仅支持 32 位或 64 位。 32 位目标的工具链分发与 64 位目标完全不同。

您可以并排安装两个工具链,但不能有一个带有目标开关的工具链。

(我听说有人做过 mingw-w64 的多目标单工具链发行版,但很可能这不是你已经安装的)。

听起来您只安装了 64 位目标版本。您还可以考虑安装 mingw-w64 的 32 位目标工具链。

【讨论】:

  • 你有支持 c++20 的 32 位 mingw 版本的链接吗?
  • @DarkoNaito_09 我建议通过 MSYS2 包管理器安装,请谨慎关注these instructions
  • @DarkoNaito_09 当您在 MSYS 中时,或者稍后当您有更多时间探索时,请查看 MSYS 提供的库的广度。当您发现项目需要一个库时,很有可能它已经为您的工具链构建并可供您安装。
猜你喜欢
  • 2011-12-22
  • 2016-05-17
  • 1970-01-01
  • 2011-12-12
  • 1970-01-01
  • 2012-01-18
  • 2020-09-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多