Code: Block + MinGW + wxWidgets Windows GUI Program Development

Source: Internet
Author: User
Tags wxwidgets

Code: block + mingw + wxWidgets Windows GUI Program Development

Development Environment:
Windows 7
GCC version 4.6.2 In mingw
Code: block version 10.05
WxWidgets version: 2.8.12
 
1. Compile wxWidgets
Set the bin directory of mingw to one of the system's path environment variables.
Install wxWidgets under E: \ and enter the command
Cd e: wxWidgets-2.8.12 \ build \ MSW
Mingw32-make-F makefile. GCC build = release Unicode = 1
Mingw32-make-F makefile. GCC build = debug Unicode = 1

You do not need to compile the debug version. However, we recommend that you generate a debug library for debugging. Unicode = 1 specifies that the compiled wxWidgets Library supports Unicode.
Compilation takes about half an hour.

2. Use code: blocks to develop wxWidgets
Open code: blocks and create a wxWidgets project.
Select wxWidgets 2.8.x and enter the project name.
When you select the wxWidgets directory, enter E: \ wxWidgets-2.8.12, and the next step will be a window to set global variables, or you can enter from the menu below settings.
Set global variables:
Create an environment variable wx with the following settings:
Base: pointing to E: \ wxWidgets-2.8.12
Include: points to E: \ wxWidgets-2.8.12 \ include
Lib: E: \ wxWidgets-2.8.12 \ lib

Click Close, and Enable Unicode will be checked later.

Open the Code: Block compiler settings page and enter the following information in the Search directories tab:
Complier
$ (# Wx. include)
$ (# Wx. lib) \ gcc_lib \ mswu
$ (# Wx) \ contrib \ include

Linker
$ (# Wx. lib) \ gcc_lib
$ (# Wx) \ build \ msw \ gcc_mswu

Click compile and run.

3. Solve the problem:
A. if the following error occurs during application compilation, the gcc is different from wxWidgets.
Undefined reference to '_ Unwind_Resume'

B. "libgcc_s_dw2-1.dll is missing" appears in the compiled file separately"
This is a MinGW/gcc compiler issue, rather than a Microsoft Visual Studio setup.
The libgcc_s_dw2-1.dll shocould be in the compiler's bin directory. you can add this directory to your PATH environment variable for runtime linking, or you can avoid the problem by adding "-static-libgcc-static-libstdc ++" to your linker flags.
If you plan to distribute the executable, the latter probably makes the most sense. if you only plan to run it on your own machine, the changing the PATH environment variable is an attractive option (keeps down the size of the executable ).

Settings -- Compiler and debugger -- Global Compiler settings -- Linker settings, add the following two lines to 'other linker options ':
-Static-libgcc
-Static-libstdc ++
4. Miscellaneous
You can use wxFormBuilder or wxSimth to design the GUI layout.
Compile the wxWidgets sample code that comes with code blocks. The executable file size of the debug version is 27.49 MB, and that of the Release version is 1.95 MB.

5. Reference
Http://www.cnblogs.com/zimmerk/archive/2012/06/07/2541082.html
Http://stackoverflow.com/questions/4702732/the-program-cant-start-because-libgcc-s-dw2-1-dll-is-missing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.