本文介绍了在CodeBlocks中更改链接器顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目在DialogBlocks 5.03编译罚款与mingw32,但使用CodeBlocks 13.12显示此错误:

I have a project in DialogBlocks 5.03 that compiles fine with mingw32, but using CodeBlocks 13.12 show this error:

F:\wxWidgets-3.0.0\lib\gcc_lib/libwxmsw30u_core.a(corelib_msw_listctrl.o):listctrl.cpp:(.text+0x1019): undefined reference to `ImageList_GetImageCount@4'
F:\wxWidgets-3.0.0\lib\gcc_lib/libwxmsw30u_core.a(corelib_msw_listctrl.o):listctrl.cpp:(.text+0x1063): undefined reference to `ImageList_Draw@24'
F:\wxWidgets-3.0.0\lib\gcc_lib/libwxmsw30u_core.a(corelib_msw_listctrl.o):listctrl.cpp:(.text+0x108c): undefined reference to `ImageList_GetIconSize@12'

我已经检测到这是库的链接器顺序,在DialogBlocks中这是库顺序:

I have detected that is the linker order of the libraries, in DialogBlocks this is the library order:

轮候册, - 子系​​统,窗口-mwindows -static-libgcc的-static-的libstdc ++ -lwxmsw30u_xrc -lwxmsw30u_richtext -lwxmsw30u_aui -lwxmsw30u_html -lwxmsw30u_stc -lwxmsw30u_propgrid -lwxmsw30u_ribbon -lwxmsw30u_adv -lwxmsw30u_core -lwxbase30u -lwxbase30u_net -lwxbase30u_xml -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32

并且它编译成功

在CodeBlocks这是编译器库顺序:

In CodeBlocks this is the compiler library order:

-mthreads -s -static-libgcc -static-libstdc ++ -Wl, - 子系​​统,windows -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 - luuid -lcomctl32 -lwsock32 -lodbc32 -lwxscintilla -lwxmsw30u_xrc -lwxmsw30u_richtext -lwxmsw30u_aui -lwxmsw30u_html -lwxmsw30u_stc -lwxmsw30u_propgrid -lwxmsw30u_ribbon -lwxmsw30u_adv -lwxmsw30u_core -lwxbase30u -lwxbase30u_net -lwxbase30u_xml -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -mwindows

如果我使用DialogBlocks链接器选项从命令行编译CodeBlocks项目,它会成功编译

If I compile the CodeBlocks project from command line using the DialogBlocks linker options, it compiles successfully

所以在CodeBlocks菜单:Project - > Build选项 - >链接器设置,我按我想要的顺序添加库,但CodeBlocks以自己的顺序添加参数,甚至重复库

So in the CodeBlocks menu: Project -> Build Options -> Linker Settings, I add the libraries in the order that I want but CodeBlocks adds the parameters in its own order, even repeating the libraries

如何更改订单?

推荐答案

感谢Sandro我找到了答案

Thanks to Sandro I found the answer

我有CodeBlocks 13.12,改变链接器参数你必须去菜单:

I have CodeBlocks 13.12, to change the linker params you must go to the menu:

$ linker $ libdirs -o $ exe_output $ link_objects $ link_resobjects $ link_options $ libs -mwindows

到:

$ linker $ libdirs -o $ exe_output $ link_objects $ link_resobjects $ link_options

然后转到菜单:

这篇关于在CodeBlocks中更改链接器顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 03:22