Using wx-config

team bbl


Using wx-config

When you build wxWidgets using configure and make, wxWidgets creates a special script called wx-config, which produces the necessary compiler flags for compiling and linking wxWidgets programs, and manages returning the correct flags when you have multiple versions of the wxWidgets libraries installed in the same location (such as /usr/local). You can use wx-config from makefiles or run it by hand to see what flags you need to insert into your IDE settings. If you're using Visual Studio, BC++, or MinGW without MSYS, you won't use wx-config.

If you look in your wxWidgets build directory, you will see wx-config there, and also in /usr/local/bin if you ran make install.

The flags that produce the necessary compile and link settings are --cxxflags and --libs, respectively. For example, on Mac OS X, the output of each could be

 $ wx-config --cxxflags -I/usr/local/lib/wx/include/mac-unicode-release-static-2.6 -I/usr/local/include/wx-2.6 -D__WXMAC__ -D_FILE_OFFSET_BITS=64  -D_LARGE_FILES -DWX_PRECOMP -DNO_GCC_PRAGMA $ wx-config --libs -L/usr/local/lib   -framework QuickTime -framework IOKit -framework Carbon -framework Cocoa -framework System  /usr/local/lib/libwx_macu_xrc-2.6.a /usr/local/lib/libwx_macu_html-2.6.a /usr/local/lib/libwx_macu_adv-2.6.a /usr/local/lib/libwx_macu_core-2.6.a /usr/local/lib/libwx_base_carbonu_xml-2.6.a /usr/local/lib/libwx_base_carbonu_net-2.6.a /usr/local/lib/libwx_base_carbonu-2.6.a -framework WebKit -lexpat -lz  -lpthread -liconv -lwxregexu-2.6 -lwxtiff-2.6 -lwxjpeg-2.6-lwxpng-2.6 

Without passing these flags to the compiler and linker when building your own applications, you are likely to receive hundreds of errors because the compiler won't know anything about the wxWidgets classes that your program is using.

Using wx-config from the Build Directory

If you did not install the wxWidgets files into /usr/local, you will need to use wx-config "in-place," meaning that it will produce absolute paths to that build's files right from the build directory. This should be done by passing the ---inplace flag to wx-config with whatever flags you are requesting. Even if you did run make install, nothing prevents you from using the in-place flag with a particular build of wxWidgets. When running in-place, you do not need to pass any build configuration parameters because an in-place wx-config knows only about one build, the build from which you are running wx-config in-place.

Using wx-config from /usr/local and Choosing Your Configuration

When you have built and installed multiple configurations of wxWidgets, you can specify to wx-config which configuration's build flags you would like returned. For example, if you are creating both debug and release builds of your project, you should be sure to get the correct flags for each configuration from wx-config, for example:

 wx-config --debug=no 

or

 wx-config --debug=yes 

Many options are available to choose specific build configurations. The most commonly used flags are

[View full width]

wx-config [--inplace] [--unicode[=yes|no]] [--debug[=yes|no]] [--version[=VERSION]] [--release] [--static]

You can also retrieve a list of available configurations using wx-config list.

A full list of flags is available by using wx-config --help.

    team bbl



    Cross-Platform GUI Programming with wxWidgets
    Cross-Platform GUI Programming with wxWidgets
    ISBN: 0131473816
    EAN: 2147483647
    Year: 2005
    Pages: 262

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net