How to install Wt (Witty) on Windows
Installing Wt can be a challenging task if you don’t have the right tools. I spent many days trying to make it work with MinGW and Visual Studio 2005. No luck. Here are some of my results:
I was never able to make a full compile. It was interrupted by this or that reason. I could never get any of the examples to work.
Visual C++ Express 2005
Some of the examples worked, however only in “Release” mode. They never worked in debug mode, even though they compiled and linked successfuly. The INSTALL project didn’t work ethier.
Visual C++ Express 2008
Back to the honey moon… It worked perfect. The full process to make it work is described next.
1. You need a working copy of Microsoft Visual C++ Express 2008. You can download the Microsoft Visual Studio 2008 Express Edition from the Microsoft Visual Studio Express 2008.
I highly recommend you to create and run a basic Hello World program just to make sure your installation works.
2. Now download Wt from the Wt website. I downloaded version 3.2.2-p1. Unzip it to your hard disk.
3. You have to get the Boost Libraries. That is the only required library by Wt. Plus they are very helpful. You can download a Boost precompiled binary version from the Boostpro website. I’m doing this installation using version 1.47. During the installation you will be prompted to select the libraries you want to download. I recommend you to get all the multithreaded versions to avoid problems.
4. CMake is the last requirement. It is needed to create the configuration file for Wt. It is simple to use and all of the options are presented on a nice window. You can get it from the CMake website. For this exercise I will use version 2.8. During the installation you will be prompted to add the CMake application to the system path, but this is not necessary.
Everything is installed. Now it’s time to create the configuration files.
Go to Start > All Programs > CMake 2.8 > CMake (cmake-gui)
Set the Where is the source code: value by pressing the Browse Source button and looking for the folder where you unzipped Wt.
Next, set the Where to build the binaries: to the value of the last field, and add /build to the end. /build is the recommended folder where all your files will be compiled to.
Now press the Configure button.
You will get “many” errors. This is correct. Most of them are related to the Boost library. Look for the following variables and change the values as follows:
BOOST_PREFIX = C:/opt/cpp/boost/boost_1_47 WT_NO_BOOST_RANDOM = false
- BOOST_PREFIX has to point to your boost installation folder. It can contain spaces, and by default should be something like C:/Program Files/boost/.
- WT_NO_BOOST_RANDOM should be false for Boost versions newer than 1.45. On that version, Boost changed some of its interfaces, so this is an important property.
Update: Another error you might encounter in CMake is “The C compiler “cl” is not able to compile a simple test program.” This means that your Visual Studio won’t find ‘cmd’ as it isn’t configured correctly.
What you must do is change the Microsoft Visual C++ options (Tools menu > Options > Project and Solutions > VC++ Directories) to ensure that
are specified BEFORE $(PATH).
Press the Configure button again. This time you should see less errors. Press it again.
Now you should be ready to generate the solution, so press the Generate button.
Open Windows Explorer and go to the build folder inside the one where you unzipped Wt. You should see a solution named WT. Double click it to open it.
You will see many projects in your Solution Explorer. We will start by compiling only the key ones to make problem solving easier (in case problems arise). So right click on wt and select build.
You will see some warnings during compiling. That’s correct. But at the end you should see the famous Build: 1 succeeded message, 0 failed.
Now do the same to the wthttp project and finally to the hello project.
If compilation went fine (of course it went fine!, why it would not?) we are ready for the next phase: testing.
Right click on the hello project and select Set as StartUp Project.
Right click again on it and select Properties. Add the following string to the Command Arguments under Debugging:
--http-address=0.0.0.0 --http-port=8080 --deploy-path=/hello --docroot=.
Click Run. Your application should run showing a screen like the following:
Open your Internet browser and go to http://localhost:8080/hello.
In Visual C++ go to the Solution Explorer and look for a project named INSTALL. Right click on it and choose Build. When the process finishes, go to C:Program FilesWt. You will find the Wt include and lib folders there.