Build a cross-platform programming environment code: blocks + wxWidgets

Source: Internet
Author: User
Tags wxwidgets

Here we take the latest code: blocks 1.0rc2 and wxWidgets 2.6.2 as an example to describe how to set up the code: blocks + wxWidgets environment on the Windows platform and FreeBSD platform, and the methods on other platforms as an example.

Windows
  1. To code: blocks official website http://www.codeblocks.org download code: blocks + minggw installation package, download and install with the default settings.

  2. Set the environment variable and add C:/program files/codeblocks/bin to the path environment variable. For Windows XP, right-click "my computer" and select "properties" in the pop-up menu. In the displayed dialog box, click the "advanced" tab, click the "environment variables" button below, select "path" in "system variables", and click "edit; add "; C:/program files/codeblocks/bin" at the end of the "variable value" column in the pop-up dialog box (no quotation marks are required). "OK" All dialog boxes are available. We recommend that you restart your computer to make the new environment variables take effect.

  3. Download the wxWidgets installation package from the http://www.wxwidgets.org on the wxWidgets official website, and install it with the default settings.

  4. Open a command line Console (Start Menu-> Program/All Programs-> attachment-> command prompt) and execute the following code for compilation:

    1. C:
    2. CD/wxWidgets-2.6.2/build/MSW/
    3. Mingw32-make-F makefile. GCC build = release clean
    4. Mingw32-make-F makefile. GCC build = release

    This is a long compilation process.

  5. ...... (Do other things)

  6. After compilation is complete, open code: blocks and create a wxWidgets project. compile the project to see if it can be run.

  7. If the project is created using wxWidgets DLL, The wxmsw26_gcc_custom.dll file may be missing during running. In this case, one of the following three methods can be selected so that the program can find the DLL:

    1. Copy C:/wxWidgets-2.6.2/lib/gcc_dll/wxmsw26_gcc_custom.dll to C:/Windows/system32 /;

    2. Copy C:/wxWidgets-2.6.2/lib/gcc_dll/wxmsw26_gcc_custom.dll to the folder where the project is located;

    3. Add C:/wxWidgets-2.6.2/lib/gcc_dll/to the path environment variable.

  8. If the project is created using static wxWidgets library, it may be reported that the wxmsw library cannot be found in LD during compilation (build. Select project> build options from the menu, click the "linker" tab in the displayed dialog box, click "wxmsw" in the list, and click "edit, change it to "wxbase26" and click "add". In the displayed dialog box, enter "wxmsw26_core" and click "OK". Then, use the triangle button next to it to promote it to the top; compile the project again. If the program uses other libraries, add them here and pay attention to the order.

Under FreeBSD
  1. Install code: blocks from ports

    Run the following command as root:

    1. CD/usr/ports/devel/codeblocks/
    2. Make install clean

    The wxgtk2 and wxgtk2-common ports are automatically installed after you run this command. If not, install it on your own.

  2. Returns the identity of a common user. Open code: blocks (you can execute codeblocks in the command line to open it. If it is a CSH shell, you must first execute rehash after installation), create a wxWidgets project and try to compile it, if yes, the installation is successful.

  3. If 'wxgtk2-2.6-config: no such file or directory is reported during compilation, open a term and execute:

    1. Wxgtk2-2.6-config -- cflags

    Do not close this term after execution. Click code: blocks menu project-> build options. In the displayed dialog box, click the "compiler" tab and select the "Other Options" tab, replace 'wxgtk2-2.6-config -- cflags 'with the output in the term. Run the following command in term:

    1. Wxgtk2-2.6-config -- libs

    Click the linker tag in the build Options dialog box in code: blocks. In other Linker Options, replace 'wxgtk2-2.6-config -- libs' with the output in the term.

  4. Recompile the project and you will be able to pass it.

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.