在CodeBlocks中更改链接器顺序 [英] Change linker order in CodeBlocks

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

问题描述

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

  F: \wxWidgets-3.0.0\lib\gcc_lib / libwxmsw30u_core.a(corelib_msw_listctrl.o):listctrl.cpp :(。text + 0x1019):未定义引用`ImageList_GetImageCount @ 4'
F:\ wxWidgets-3.0.0 \lib \gcc_lib / libwxmsw30u_core.a(corelib_msw_listctrl.o):listctrl.cpp :(。text + 0x1063):未定义引用`ImageList_Draw @ 24'
F:\wxWidgets- 3.0.0 \lib\gcc_lib / libwxmsw30u_core.a(corelib_msw_listctrl.o):listctrl.cpp :(。text + 0x108c):未定义引用`ImageList_GetIconSize @ 12'
/ pre>

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



轮候册, - 子系​​统,窗口-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这是编译器库顺序:



-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项目,它会成功编译



因此,在代码块菜单:项目 - >构建选项 - >链接器设置,我添加库的顺序,我想,但代码块添加参数,在它自己的秩序,甚至重复库



如何更改订单?

解决方案

感谢Sandro我找到了答案



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


- >编译器 - >标签:其他设置 - >点击按钮:高级
选项... - >它显示一个消息框警告,单击:是 - >在
命令组合框选择:链接对象文件执行和更改


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



到:



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


点击


然后转到菜单:


项目 - >构建选项... - >选项卡:链接器设置 - >在:其他链接器
选项,我添加了我自己的有序libs


>


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'

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

-Wl,--subsystem,windows -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

And it compiles successfully

In CodeBlocks this is the compiler library order:

-mthreads -s -static-libgcc -static-libstdc++ -Wl,--subsystem,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

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

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

How I change the order?

解决方案

Thanks to Sandro I found the answer

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

Settings -> Compiler -> Tab: Other settings -> Click button: Advanced options... -> It shows a message box warning, click: Yes -> In the Command ComboBox select: Link object files to execute, and change this:

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

to:

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

Click button: OK

Then go to menu:

Project -> Build options... -> Tab: Linker settings -> In: Other linker options, I added my own ordered libs

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆