External Links

Building WxPic

The following steps are necessary to build executables and installer.

Windows (Win32)

Environment Installation

MinGW / GCC / Code::Blocks Installation

You have first to install Code::Blocks with the installer that also contains MinGW GCC. Select all options so that you miss nothing. It is supposed in the following paragraphs that it is installed in its default directory C:\Program Files\CodeBlocks. For more information on Code::Blocks installation refer to Code::Blocks website.

After the installation you can run Code::Blocks and ask for discovery of the GCC compiler. I also recommand to change a setting that will make your life easier. In Code::Blocks open General Setting through the menu Settings > Environment ... Then select the option On application start-up : Open default workspace. Then exit Code::Blocks without saving any workspace. Next times you will open Code::Blocks you will be always in your default workspace so you won't have to re-select it.


wxWidgets Installation

Just use the wxWidgets Installer. It is supposed later that you have kept the default installation directory that is C:\wxWidgets-2.8.11

You must define an environment variable named wxWidgets with the path where is installed wxWidgets, in this example: C:\wxWidgets-2.8.11

To define the environment variable, refer to this support page.


wxWidgets Library Generation

You have 2 options at that point. Either you generate the libraries yourself or you download the pre-compiled wxWidgets libraries for WxPic that you can download above.

Full Generation option

This requires that your MinGW GCC compiler and associated tools are accessible by simply typing their executable names. This can be obtained by adding their bin directory to the Path environment variable. If you used the standard directory installation, you must to add C:\Program Files\CodeBlocks\MinGW\bin to your Path environment variable. Remember to use a semicolon (';') to separate the new path from the existing path list. Refer to this article for help on updating Environment Variables.

You can verify this is correctly done by opening a cmd window to enter the command gcc -v . This must dump you the gcc version. If you get an error that says the command is not recognized your Path variable has not been correctly updated.

Remember that the change of an environment variable is not effective for all applications that are already started. So the cmd window must have been started AFTER the Path variable has been updated and that this change has been validated.

Before generating the wxWidgets libraries the WxPic specific setup.h file must be installed. If you don't, the generated libraries will contain some unused functions that require more libraries than linked in the WxPic project (typically you will have to link JPEG and PNG libraries into your application though they are used nowhere in WxPic) leading to a larger executable than required. This does not really hurt but that's not how WxPic is generated.

So rename the setup.h.V2.8.11 you can download above, to setup.h

Then copy this file to the directory C:\wxWidgets-2.8.11\include\wx\msw . This will replace the existing default setup file. You may want to rename it before to keep a backup copy of default setup, or you may notice that it already exists a backup called setup0.h in the same directory.

You are now ready to run the compilation of the libraries. Two sets of libraries are used by WxPic: Release and Debug. Obviously the Release library set is used when you generate the W32 Release build of WxPic and Debug Libraries for W32 Debug build. Each set of libraries have to be generated separately and generates different files. You may choose to generate both or only one of them. Note that this is a long operation so generating only one can make sense.

To generate the Release set of wxWidgets libraries for WxPic go to the following directory:


And enter the following command:

mingw32-make -f makefile.gcc BUILD=release UNICODE=1 CFG=wxpic

And for the Debug set:

mingw32-make -f makefile.gcc BUILD=debug UNICODE=1 CFG=wxpic

Each of these commands may take up to half an hour. So be patient.

Once you have completed the generation you can restore the default setup.h file if you wish. In fact the library generation commands above have installed a copy of the modified setup.h file in a dedicated directory where it will be found when compiling WxPic.


Using the pre-compiled Libraries Option

If the operations above seem a little scary for you, you can download and use the pre-compiled libraries available on the download page. You must uncompress them in the following directory that needs to be created:


As a result you will get the following files:


The WxPic specific setup.h-V2.8.11 file needs also to be copied in a new directory after having been renamed setup.h . The new directory to create is mswu\wx in the directory you just created for the library. So at the end you will get the file:


Note that these pre-compiled libraries are only the Release libraries, so they won't allow you to build the WxPic Win32 Debug version.


Source Extraction

Create a directory where WxPic will be developped. It can be anywhere until the length of the path is not too long (avoid more than 150 characters). In the following it will be supposed that the WxPic directory is D:\WxPic

From Source Archive

Uncompress the 7z source archive keeping the file structure in the selected directory.

From SVN repository

Check Out or Export the Trunk from the repository at URL:

Or a specific tagged version like V1.2.2 at:


Version Definition

Three files must be created to hold the reference of the version to build.


This file is to be created in the src directory and must follow the following format :

#define SVN_DATE (_T("2011-03-25T18:51:29.447729Z"))
#define SVN_REVISION (112)
#define SVN_VERSION (_T("V1.2.2"))
#define FULL_SVNVER (_T(""))
#define SVN_MANAGED (true)

These definitions are:

Indicates if the version correspond to a version identified by the Source Configuration Management. If SVN_MANAGED is false the SVN_VERSION will be ignored.
Date to tag the version
Revision corresponding (approximatively if SVN_MANAGED is false) to the generated executable
Name of the generated version
Four point-separated number version. Last number usually is equal to the SVN_REVISION



This file is to be created at the root of the project directory and must follow the following format:

<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
 	<assemblyIdentity version="" processorArchitecture="X86" name="WxPic" type="win32"/>
 	<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
 				<requestedExecutionLevel level="highestAvailable"/>

The only field to replace in this example is the version at XPATH=assembly/assemblyIdentity/@version

This value should be equal to the FULL_SVNVER of the version.autogen file.

The remaining of the file must be left unchanged. Note that the file model.manifest in the resources directory contains the model above.



This file is to be created at the root of the project directory and must follow the following format :


It contains the version date (typically the same as SVN_DATE of version.autogen) composed of the Year, Month, Day, Hour and minutes all on 2 digits.


C++ Compilation

Now that all the environment is installed, the library compiling WxPic is an easy operation.

You have now your own WxPic binary. It is located in the bin\Win32Release directory (if you have selected the target Release Win32). This binary can be used to replace the WxPic.exe installed by the installer. This is sufficient to run it. Though if you want to go further and generate a new installer you have to continue with the following paragraphs.


Language File Compilation

It exists only one translation at this time. The French translation. New translation can be created on the same model. To compile a language file use the gettext tools with the following command, to be applied in each langage file directory:

msgfmt -o WxPic.po

Note that for the msgfmt to be recognized without giving its full path you need to add the GnuWin32 binary directory in the Path. The tool installer doesn't do it.


Help Anchor Creation

The browsers are not all able to open a page provided with an anchor so that a specific paragraph of the page is displayed. To workaround this problem, WxPic uses redirection pages that point to the anchors. These files are very simple HTML pages with the following content:

<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<html  xmlns="">
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<meta http-equiv="refresh" content="1;url={Url}.html#{Anchor}" />

One file of this type must exist per entry with enchor in the help. These entries are listed in the file Web/Help/ and have an anchor attribute. At this time only one such entry exists. {Url} must be replaced by the value of the url attribute of the entry and {Anchor} must be replaced by the value of the anchor attribute. And finally the file must be named {Url}++{Anchor}.html .

If you have a XSLT 2.0 processor available you can build these files by calling the processor with:

Input file
The file
XSLT stylesheet file
The MAP2Redirect.xslt file
Where <the-target-directory> is the directory where to put the HTML files.


Installer Compilation

The installer expected that all the necessary files are gathered at a place where the Release (optionally Debug) version is generated. If all the files are correctly copied at the right place expected by the installer, the corresponding WxPic can be successfully tested. Only the MPLAB device files that are not part of the distribution will be missing (though you can add it for testing before generating the installer).

The file organization is the following with the directory bin/Win32Release as root:

When the files have been organized as described above, the generated binary can be tested and the installer can be generated with the following operations:

The installer is generated in your WxPic directory.

Alternatively, to generate the installer, you can right-click on the WxPic.nsi file in your directory project and select Compile NSIS Script.



I am using Ubuntu so I will describe to you the building step under this system. My knowledge of Linux is too limited to help you extrapolating to other Linux flavor. I have not been able to build a package, so the generated binary is a tar of the files to be installed manually.

Package Installation

The first thing to do with Ubuntu is to install all the required packages using the Synaptic package manager. Refer to the list of needed packages to select the packages to install.


Sources Extraction

No difference with the equivalent Windows operation.

Version Definition

For Unix, are the same as the Windows Version Files. Give them the same content.

But under Unix you can autogenerate these files. This auto-generation is taken into account by the Makefile (see below).

To get a significant generated version number, you must use a SVN working copy (built using SVN Check Out command) for your environment root directory. Though this Working Copy does not need to be from the official WxPic SVN repository on Sourceforge. You can have your own WxPic repository if you wish.

Compilation and Help Redirection Files Creation

On Ubuntu platform Code::Blocks works in the same way under Linux as Windows, so again yo can refer to the equivalent Windows operation except for the target build that must be Release Linux. For Linux platforms that would not have Code::Blocks available, a Makefile is provided that performs the C++ Compilation and the Executable linkage.

For Language File Compilation, the msgfmt processor is identical. So again refer to Windows instructions. But this compilation can also be performed by the Linux Makefile.

Finally the Anchor Redirection files too are identical to their Windows version. And again they can be atomatically generated by the Makefile.



This makefile can be used for compiling, for copying file in the test environment, or for installing the software. From the root of WxPic source directory:

make version
Create the version files.
Compile C++ source files and WxPic.po language files, link the executable. Start by creating the Version files.
make test
Copy all files necessary to run the generated executable, including the Help redirection files that the makefile generates itself.
make install
Same as make and then install compiled files and other necessary files to allow execution of WxPic. Warning: this option requires the root credentials to be run (under Ubuntu use sudo)
make tar
Same as Install and then build the binary archive that contains all the files necessary for execution (except standard packages listed on download page). Warning if install has not been performed before, requires the root credentials.
make clean
Delete all compilation results (created by make) and the files copied by make test.
make uninstall
Delete all files installed by make install



If you wish to contribute please contact me through the forum. There are lot of possible contributions:

Any type of contribution is welcome.