CodeBlock编辑器GCC环境下,编译报错:Execution of 'mingw32-g++.exe -o bin\Debug\test.exe obj\Debug\main.o' in 'C

在使用CodeBlock编程软件及GCC编译链进行项目开发时,遇到工程编译成功但链接阶段出错的问题。通过检查并确认g++是否正确安装及PATH设置,发现可能是MINGW编译链中g++未正确安装导致。解决步骤包括确认编译链、调整Linker配置以及保存更改后重新编译,以顺利解决链接阶段错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装CodeBlock编程软件,安装GCC编译链。GCC编译链安装完成之后,应该看到安装成功信息。新建工程,选择GCC编译链,编译之后,报错如下:

Execution of 'mingw32-g++.exe  -o bin\Debug\test.exe obj\Debug\main.o' in 'C

工程编译是成功的,main.o也成功生成,问题出在链接阶段。

mingw32-g++.exe 用于编译阶段,其成功执行,mingw32-g++.exe 用于链接,执行失败。问题最大的可能,是安装MINGW编译链时,g++没有安装,或者安装的PATH不对,可以在cmd窗口运行mingw32-g++.exe 查看结果。

CodeBlock默认的链接选项是g++,它对C/C++均有很好的支持,而且,它默认你是安装了full C/C++ toolchain.


解决办法:

  1. settings->compiler
  2. 确认编译链为GNU GCC
  3. 切换到Toolchain executables
  4. 将Linker for dynamic libs from mingw32-g++.exe to mingw32-gcc.exe
  5. 保存,重新编译即可

运行报错 -- Error occurred in anonymous codeblock; filename: ; position: 2758; line: 65 -- MAXScript Rollout Handler Exception: -- Runtime error: callbacks.addScript() unrecognized callback type: #timeSliderChange -- MAXScript callstack: -- thread data: threadID:26976 -- ------------------------------------------------------ -- [stack level: 0] -- In registerCallback(); filename: ; position: 2759; line: 65 -- member of: Rollout:GIFPlayer -- Locals: -- callbackStr: "fn updateFrameFromTime = ( try ( if isValidObj ::GIFPlayer and ::GIFPlayer.gifFrames.count > 0 do ( local currentTime = sliderTime.frame as integer if currentTime != ::GIFPlayer.lastSliderTime do ( ::GIFPlayer.lastSliderTime = currentTime ::GIFPlayer.currentFrame = currentTime + 1 if ::GIFPlayer.currentFrame > ::GIFPlayer.frameCount do ::GIFPlayer.currentFrame = ::GIFPlayer.frameCount if ::GIFPlayer.currentFrame < 1 do ::GIFPlayer.currentFrame = 1 ::GIFPlayer.picBox.image = ::GIFPlayer.gifFrames[::GIFPlayer.currentFrame] ::GIFPlayer.pbFrame.value = (::GIFPlayer.currentFrame as float / ::GIFPlayer.frameCount * 100) ::GIFPlayer.lblStatus.text = "帧: " + ::GIFPlayer.currentFrame as string + "/" + ::GIFPlayer.frameCount as string ) ) ) catch (format "回调错误: %\n" (getCurrentException())) )" -- Externals: -- callbackID: "GIFPlayerCallback_7958" -- owner: Rollout:GIFPlayer -- GIFPlayer: Rollout:GIFPlayer -- ------------------------------------------------------ -- [stack level: 1] -- called from GIFPlayer.open(); filename: ; position: 4314; line: 120 -- member of: Rollout:GIFPlayer -- Locals: -- Externals: -- registerCallback: registerCallback() -- picBox: RolloutControl:picBox in rollout:GIFPlayer : dotNetControl:picBox:System.Windows.Forms.PictureBox -- owner: Rollout:GIFPlayer -- GIFPlayer: Rollout:GIFPlayer -- ------------------------------------------------------ -- [stack level: 2] -- called from top-level
最新发布
07-16
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值