CodeBlocks:如何使用wxWidgets库DLL构建C ++ App w [英] CodeBlocks: How to build C++ App w using wxWidgets library DLLs

查看:170
本文介绍了CodeBlocks:如何使用wxWidgets库DLL构建C ++ App w的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将wxWidgets和Codeblocks的二进制文件下载并安装到装有Windows 10的PC上。Codeblocks构建并运行HelloWorld。然后使用Codeblocks打开一个使用wxWidgets的现有DEV-C ++项目-Codeblocks可以毫无问题地进行编译,但是链接器失败,并显示一条消息,即Widgets的库dll文件是无法识别的格式。
花了几个小时在此论坛和小部件网站上寻求帮助。我已经阅读了有关导出库的信息,该库可在App中的调用与共享DLL中的函数之间架起桥梁,但未能找到它们。链接到Widgets库的正确方法是什么?谢谢您能给我的任何帮助。

I have downloaded and installed binaries of wxWidgets and Codeblocks onto my PC with Windows 10. Codeblocks builds and runs HelloWorld. With Codeblocks I then open an existing DEV-C++ project which uses wxWidgets - Codeblocks compiles this with no problems, but the linker fails with a message that a library dll file of Widgets is an "unrecognized format". have spent several hours looking for help on this forum and on the widgets site. I have read about Export Libraries which bridge the gap between the calls in the App and the functions in the shared DLLs, but have failed to find them. What is the correct way to link to the Widgets library? Thank you for any help you can give me.

推荐答案

我建议使用以下代码构建wxWidgets库:而不是下载使用未知编译器构建的二进制库

I would suggest building the wxWidgets libraries with code:blocks from source, rather than downloading a binary library that was built with an unknown compiler

此处是使用code:block构建wxWidgets静态库的说明。 Ti生成DLL,修改步骤8。(请注意,如果您使用静态库,您的应用程序将启动得更快。

Here are instructions to build the wxWidgets static libraries with code:block. Ti build DLLs, modify step 8. ( Note that your applications will start faster if you use the static library.

https://github.com/wxWidgets/wxWidgets/releases/download/v3。 1.0 / wxWidgets-3.1.0.7z

解压缩到文件夹在我的系统上,我使用C:\Users\James\code\ \wxwidgets-3.1.0

Unpack to a folder. On my system, I use C:\Users\James\code\wxwidgets-3.1.0

打开命令窗口。

cd到code :: blocks mingw文件夹在我的系统上,这是C:\Program Files(x86)\CodeBlocks16\MinGW

cd to the code::blocks mingw folder. On my system this is C:\Program Files (x86)\CodeBlocks16\MinGW

键入mingwvars.bat

Type mingwvars.bat

cd到wxwidgets文件夹在我的系统上,C:\Users\James\code\wxwidgets-3.1.0

cd to wxwidgets folder. On my system C:\Users\James\code\wxwidgets-3.1.0

cd到./ build / msw

cd to ./build/msw

类型 mingw32-make SHELL = CMD.exe -j4 -f makefile.gcc BUILD = release UNICODE = 1 SHARED = 0 MONOLITHIC = 1 如果出现奇怪的找不到文件错误,则需要编辑make文件-详细信息在这里 http://stackoverflow.com/a/41498057/16582

Type mingw32-make SHELL=CMD.exe -j4 -f makefile.gcc BUILD=release UNICODE=1 SHARED=0 MONOLITHIC=1 If you get strange 'file not found' errors you will need to edit the makefile - details are here http://stackoverflow.com/a/41498057/16582

设置代码::如下阻止全局变量wxwidgets:

Set code::blocks global variable wxwidgets as follows:

base                      C:\Users\James\code\wxWidgets-3.1.0
include                   C:\Users\James\code\wxWidgets-3.1.0\include
lib                       C:\Users\James\code\wxwidgets-3.1.0\lib\gcc_lib
setup ( user-defined )    C:\Users\James\code\wxWidgets-3.1.0\lib\gcc_lib\mswu

这篇关于CodeBlocks:如何使用wxWidgets库DLL构建C ++ App w的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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