WxWidgets (1): Build wxWidgets 3.0 environment under Mac

Source: Internet
Author: User
Tags wxwidgets

This text connection: http://blog.csdn.net/freewebsys/article/details/45643897 reprint Please specify the source!

1, about wxwidgets

Reference: Http://zh.wikipedia.org/wiki/WxWidgets
WxWidgets (Windows and X widgets, first named Wxwindows[1]) is an open source, cross-platform Object toolset (widget toolkit) whose libraries can be used to create basic graphical user interfaces (GUIs). Wxwidgets was first developed by Julian Smart in 1992.
Wxwidgets advertised that the software developed with its libraries requires only minor changes to the source code (or without changes at all) to compile and run on a variety of different job platforms. Windows, Apple Macintosh, Linux/unix (translated into X11, GTK +, motif, etc.), OpenVMS, and OS/2 are currently supported. The embedded version is also under development [2].
The library itself is developed in the C + + language, but there are other different programming languages such as: Python (WxPython), Lua (Wxlua), Perl (Wxperl), Ruby (Wxruby), Smalltalk (Wxsmalltalk), Java (wx4j), and even JavaScript (WXJS).
Software developed with Wxwidgets does not need to be run with the technology of a virtual machine, although similar or even identical source code can be used on different platforms, but its final translation and generation of executable files is entirely based on the job platform.
In addition, wxwidgets can not only be used to create a GUI, it also has built-in support for ODBC-based database functions, interprocess communication, and network socket functions.
Wxwidgets's authorized License is certified by the Open Source Association, which is essentially equivalent to the GNU Wide general Public License (LGPL). An exception is however that the wxwidgets authorization allows the modifier to be released with his own license.

2, compile and install the source code

My Mac environment at the time. download code compilation directly.
Https://github.com/wxWidgets/wxWidgets/releases
Download version 3.02, unfortunately compile the error, directly download the master code compilation.

./src/osx/webview_webkit.mm:936:25variableoftype‘WebBackForwardListwithoftype      ‘WKBackForwardList *‘    WebBackForwardList* history = [m_webView backForwardList];

Wxwidgets doesn ' t build on Mac OS 10.10
Http://trac.wxwidgets.org/ticket/16329#comment:22
3.02 is released in 14, my Mac updates fast, the wood has to keep up (each time I can't stand the update prompt, must give updates).

wget https://github.com/wxWidgets/wxWidgets/archive/master.zipunzip master.zip

View the Apple SDK version

ls /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk MacOSX10.9.sdk

Different SDK numbers are different for each operating system version. Modify the compilation Parameters SDKs Macosx10.10.sdk, and then compile: (compilation can be long, wait patiently.) )

Sudo./configure-- with-cocoa --Without-subdirs -- with-macosx-version-min=10.10 -- with-macosx-SDK=/applications/xcode.App/contents/developer/platforms/macosx.platform/developer/sdks/macosx10. Ten.SDK Cxxflags="-stdlib=libc++-std=c++11"Objcxxflags="-stdlib=libc++-std=c++11"Cppflags="-stdlib=libc++"Ldflags="-stdlib=libc++"CXX=Clang++Cxxcpp="clang++-E"Cc=Clang CPP="Clang-e" --Enable-debugMakesudo make Install

These parameters must be added, otherwise the error is below the Mac:

/usr/local/include/wx-3.1/wx/strvararg.h|27‘tr1/type_traits‘filenot found

After compiling, you can install IDE tools.

3, download Code::Blocks

Http://www.codeblocks.org/downloads

Mac Direct compression is an app. can be used directly.

Create a new demo project.

Choose to create a wxwidgets project:


Select Wxwidgets Version:

Enter project name

Nothing, just the next step.



Create complete. Enter the project.

3, compiling the project

Reference:
http://blog.csdn.net/freecamel/article/details/6881852

First run at the terminal:

wx-config--cxxflags
-I/usr/local/lib/wx/include/osx_cocoa-unicode-3.1-I/usr/local/include/wx-3.1-D_FILE_OFFSET_BITS=64-DWXUSINGDLL-D__WXMAC__-D__WXOSX__-D__WXOSX_COCOA__

Then copy the output to the Settings >> Compiler Settings >>other Options

First run at the terminal:

wx-config--libs
- L/usr/Local/lib-frameworkIOKit-frameworkCarbon-frameworkCocoa-frameworkAudiotoolbox-frameworkSystem-frameworkOpengl-LWX_OSX_COCOAU_XRC-3.1 -lwx_osx_cocoau_html-3.1 -lwx_osx_cocoau_qa-3.1 -lwx_osx_cocoau_adv-3.1 -lwx_osx_cocoau_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1

Then copy the output to Settings >> Linker Settings >> other Linker options:

Then click on the pinion to compile. Click on the triangle to run.
If error:

fileordirectory,  fileordirectory

Description The installation above is not configured correctly. Reconfigure Complier and linker.

4, Final run effect


Summary: wxWidgets development of cross-platform GUI is still very good. At the same time can consolidate the knowledge of C + +.

5, more ideas

This text connection: http://blog.csdn.net/freewebsys/article/details/45643897 reprint Please specify the source!

The Wxpython is encapsulated for Wxwidget. is going to do a Golang package. With Swig, Golang (http://www.swig.org/) is already supported, and the Wxpyton code is migrated directly. It is not possible to re-develop a GUI library, all reference wxpython is a more efficient approach and is now just an idea.

WxWidgets (1): Build wxWidgets 3.0 environment under Mac

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.