WxWidgets beginner Guide (2) -- download and install wxWidgets

Source: Internet
Author: User
Tags wxwidgets

WxWidgets full directory for beginnersPDF and attachment download 1 Preface
2. Download and install wxWidgets
3 wxWidgets application initial experience
4 wxWidgets learning materials and usage instructions
5. Use wxSmith for Visual Design
Appendix: learning material list
2. Download and install wxWidgets

This information can be found from the Internet. WxWidgets documents cover a variety of operating systems and compiling environments. This is a disaster for beginners.

The following text is suitable for most beginners. In order to be able to watch and do it, please confirm: (1) You are using a Windows operating system (it is strongly recommended that you enable the development experience in Linux in a timely manner after advanced beginners); (2) code: Blocks has been installed (the version is not limited, but it should not be too low); (3) Code: Blocks uses the gcc compiler and is installed with Code: Blocks.


2.1 Download wxWidgets

The wxWidgets official website is at http://www.wxwidgets.org/downloads/. the download page is http://www.wxwidgets.org/downloads /.

As a Windows user, download the following two circled files from the download page. Windows.zipis the source code of wxwidgets. manual(html#.zip is the most important reference in the learning process (that is, the aforementioned online document ). In section 4.2, We will specifically introduce the use of online documents.

After the download, decompress the file Windows. ZIP, which is the result of my decompression, I decompress it to F:/wxWidgets-3.0.0. In this article, I will use X:/wxWidgets-3.0.0 to represent this folder, X represents the drive letter you choose.


2.2 why compile wxWidgets by yourself

For general Windows applications, there is always an installation program (usually setup.exe). As long as you run this program, you can install the software.

This is not the case with wxWidgets. Download the source code of wxWidgets instead of running programs! Open-source software is provided to users with source code, which can be directly read and modified.

Many open-source software also provides installation programs, which can be used after installation. This method is applicable to software users, rather than developers.

Now, you are a developer. As a developer, the source code is often downloaded and compiled by yourself. This is a high requirement for the public, but it is a common routine for professionals.

WxWidgets is not a common application, but a platform that supports application development. WxWidgets is intended for developers working on different operating systems (Linux, unix, Windows, and Mac OS, the C ++ Compiler (GCC, MS, Borland, and others) They use varies in different versions. WxWidgets is not easy to provide installation programs under various combinations. Developers can download the source code and compile and use it by themselves. In this way, the most suitable environment is created.

In fact, if you do not do this, you often cannot find a development environment suitable for you.

Therefore, the following steps may be challenging. But don't complain. Once you do this, you will be more effective as a developer.

In fact, wxWidgets also provides a compiled version called wxPack, which can be used for direct installation. In my experience, the latest wxPack uses a lower GCC version, and the installation is successful, but it cannot run the programs written in my development environment correctly. This method is not recommended.


2.3 preparations before wxWidgets Compilation

To compile wxWidgets, you must first prepare the compiler and configure the "Environment" of the Good Luck line compiler ".

For beginners, when installing Code: Blocks, select an installation file with the GCC compiler for installation. The GCC compiler installed separately can also be set in Code: Blocks.

Find the folder where Code: Blocks is located ("X: \ CodeBlocks \" is used in this article, and "X: \ CodeBlocks \" is used to replace "X: \ CodeBlocks \" with the actual folder name you are using ). GCC installed with Code: Blocks. In the MinGW sub-folder of the Code: Blocks installation folder, open X: \ CodeBlocks \ MinGW \ bin, as shown in, it is a GCC series program that supports your C ++ work.

Write down the folder name (simply copy the path and paste it to a text file for future use ). Next, configure the "Environment" for running the compiler. Specifically, you only need to set the "PATH.

In Win7, right-click the "computer" icon on the desktop and select "properties" from the menu. Next, we will perform a series of operations from 1 to 6, set "variable name" to "variable value" of PATH, add an English semicolon to the original value, and then add the X: \ CodeBlocks \ MinGW \ bin you noted down. Note: do not replace the original content, but append the path you need.

In other versions of Windows, the method for finding the "System Properties" dialog box may be slightly different. The final goal is to set the PATH value.

Another method is to use the doscommand directly. There is a lot of information about this practice, which is not described in this article.


2.4 compile wxWidgets

To compile wxWidgets, you must use the command line method.


2.4.1 compile wxWidgets using command lines

From the Start Menu-> attachments, run the command prompt (some systems call the MS-DOS mode) and enter the following command under the command line:

Command

Explanation

X :( press Enter)

The current disk is set to X, and X is the drive letter used to decompress wxWidgets.

Cd \ wxWidgets-3.0.0 \ build \ msw (Press ENTER)

The current directory is/wxWidgets-3.0.0 \ build \ msw, you can view the files in this folder, msw is dedicated for Microsoft (MS) Windows (w) with the need to compile the file (note: wxWidgets C ++ source code in \ wxWidgets-3.0.0 \ src ).

Gcc-v (Press ENTER)

This command is not required. It is intended to check whether the path setting is correct. The output, indicating that in the X:/wxWidgets-3.0.0 \ build \ msw directory, you can run the command in X: \ CodeBlocks \ MinGW \ bin. We can also see that the current GCC version is 4.7.1.

Is the result of running the command in the above table:

Next we can start compiling wxWidgets. At the end of the DOS prompt, enter the following command:

mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug

The compilation process is slow and may take dozens of minutes. Do something else, or just watch the prompt that you don't understand on the screen. Ideally, compilation is completed successfully.


2.4.2 accidental handling

During wxWidgets compilation, I waited for dozens of minutes and waited for an error. The last two lines indicated the following:

gcc_mswuddll\monodll_xh_bmpcbox.o: file not recognized: Memory exhausted  collect2.exe: error: ld returned 1 exit status  

In this case.


2.4.3 know more

After compiling with the above command, you can meet your learning needs. If you still want to experience and support future production of program versions for release, you can combine the SHARED and BUILD parameters.

  • The value of SHARED can be 1 or 0, which indicates that the dynamic link library (1) and static link library (0) are generated ). The difference between the two is not explained. I will understand it later, or I will know it on my own.
  • The value of BUILD can be debug or release, which indicates whether the executable file generated during application development is debug or release ).

Therefore, three other commands can be run:

mingw32-make -f makefile.gcc  MONOLITHIC=1 SHARED=0 UNICODE=1 BUILD=debugmingw32-make -f makefile.gcc  MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=releasemingw32-make -f makefile.gcc  MONOLITHIC=1 SHARED=0 UNICODE=1 BUILD=release

For more information about these parameters, see explain.




======================= Author he Lijian CSDN blog = | = Category of IT student growth guidance column (occasionally updated) ==||== C ++ online class column he Lijian Course Teaching Link (by course grade) ==|||== my book-"attacking the university against the normal energy passed to IT students" ==|==== paving the runway for IT cainiao to take off, A university that enjoys happiness and passion with its students ====


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.