如果编译失败,可以尝试把config.gcc(X:\wxWidgets\build\msw\config.gcc)中的CPPFLAGS?=后面加上-std=gnu++11 -fno-keep-inline-dllexport,即:
CPPFLAGS?= -std=gnu++11 -fno-keep-inline-dllexport
还有一个就是从网页上拷贝的编译命令有可能会出现不能识别的问题,不知道为什么,我手打mingw32-make再拷贝好眠的就能编译了,不然提示没有makefile.gcc
setup头文件找不到的问题:
wxwidgets目录下,找到include\wx\platform.h
/*
Include wx/setup.h for the Unix platform defines generated by configure and
the library compilation options
Note that it must be included before defining hardware symbols below as they
could be already defined by configure but it must be included after defining
the compiler macros above as msvc/wx/setup.h relies on them under Windows.
*/
#include "wx/setup.h"
所以我在搜索目录又添加了$(#wx.include)\msvc这一项
另外库做最好不要放在C盘,因为我放在C盘提示找不到文件,可能是因为系统对C盘保护。。。
同时拥有两个库
如何同时使用wxwidgets的debug和release库
Q: How do I use both Debug and Release builds of wx libraries?
A: I would use the default method of doing it and the default folder naming.
Using these C::B custom varibles
WX_SUFFIX="" // ANSI Release WX_SUFFIX="d" // ANSI Debug WX_SUFFIX="u" // Unicode Release WX_SUFFIX="ud" // Unicode debug
I use WX_CFG when I am using a special configuration WX_CFG="rc3"
Remember, the CodeBlocks globel variable WX needs to point to the wxWidgets folder.
Example minGW build command for "Unicode debug" 2.8.0 RC3
mingw32-make -f makefile.gcc VENDOR=rc3 CFG=rc3 USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug UNICODE=1
"VENDOR=" just puts rc3 in the DLL name; "CFG=" sets which folder the DLL is placed in. In this case in lib\gcc_dllrc3
Before using CFG in the mingw32-make build you need to do one prior wxWidget build without using it; else the build errors out. (See note below.)
"__WXDEBUG__" must be defined (in the codeblocks project setting) if you wish to link against the debug version of wxWidgets DLL. Else you will get a runtime error, when you try to run your project output.
Contributed by Tim S
Note:
- I have never gotten the following command to work
mingw32-make -f makefile.gcc VENDOR=rc3 CFG=rc3 USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug UNICODE=1
- unless I have first run this command on the same wxWidgets folders
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug UNICODE=1
- I am guessing that the build without the CFG creates a file or directory needed by the build with the CFG.