ChronoEngine:Develop a new program using MSVC wizard

From ChronoWiki

Jump to: navigation, search

The new version 2.0.0 will use GIT instead than SVN, and it will require a different build process. This tutorial is obsolete and will be removed. Look at instructions to use CMake

This represents the fastest way to start using the Chrono::Engine library. There are different methods to create a C++ program that uses Chrono::Engine (see this page to see the others).

The method described here is very easy, and can be used even if you do not have CMake.

  • it does NOT require that CMake is installed on your system,
  • it requires fery simple steps.

The drawbacks, however, are that:

  • it works only with Microsoft Visual C++ (v.9 and v.10)
  • the wizard must be installed (see downloads).

These instrunctions apply only to users of Microsoft Visual C++ (from v.9), because we will use the new 'wizard' which has been added to the Visual C++ IDE when you installed the Chrono::Engine SDK using the installer (go to the download page).

Follow the following steps.


File:Checkmark.pngStart the IDE

First of all, start the Microsoft Visual C++ IDE (version 9 or superior is required, ex. in the 'VC++ 2008 Express' edition), and go to the menu File / New / Project .. as in figure:


File:Checkmark.pngStart the ChronoEngineWizard

In the 'New Project' window, select the Visual C++ root, so you can see all types of available wizards. If the installation of Chrono::Engine has been successfully, you should see a custom wizard called ChronoEngineWizard, as in the fiure below. Select that wizard and enter a directory in 'Location' and a name in the 'Name' field, then press the 'OK' button.


File:Checkmark.pngWizard settings

Now you should see the window with the settings for the wizard:


(Note that, if things went ok during the installation of Chrono::Engine, these settings should already contain the correct paths of the directories of your Chrono::Engine SDK and your Irrlich SDK, so you should simply press the Finish button. Otherwise just press the '...' buttons and browse to the directory where you installed the SDK.)

Note: in case you uncheck the 'Use Irrlicht' button, a template project will be created anyway, but it will not use 3D visualization (it will be a very simple console program, with text output).

After you checked that the directories are correct, press the Finish button. THAT'S ALL! The project will be created in the location directory you specified!

Note. Because of a current limitation in this wizard, after you press the Finish button, the project is NOT automatically opened. So you must exit from Visual Studio, restart it, and open the project:

File:Checkmark.pngOpen the project

So, to open the project, go to the directory where you created the project, on your disk.


Now double click on the '.sln' file (the Visual C++ 'solution'), so your Visual C++ IDE will open the contents of the project. Note that the Solution Explorer window (at the left of the screen) will show the template files contained in your project, for example try to double-click on the main.cpp source file, as in the picture below:


File:Checkmark.pngSet debugger directory

Now there is an optional, but strongly suggested step. Use menu 'Project / Properties..', then select 'Configuration: All configurations', then go to the 'Debugging' section and enter $(OutDir) in the 'Working Directory' field; as in the figure below:


(This is necessary because, in this way, the current directory of the program, when launched by the debugger, will be the same where the .exe file is - this will avoid problems if the program must access relative paths).


To compile and execute the program, click on the green arrow on the toolbar (as in the picture below) or press F5.

Note. Remember to set Win32 as configuration (the drop list at the top of the screen) if you are using the precompiled Chrono::Engine that comes with the installer (even on 64bit Windows), because the 64bit libraries are not shipped with the installer.


After few seconds of compilation, you should see the simulation of a pendulum with a spring:



  • Where is the .exe ??? Usually, the Visual C++ IDE puts the compiled .exe executable into the Debug\ or Release\ subdirectories of the project: this is NOT the case when using the projects generated by the ChronoEngineWizard! In fact, projects generated by the ChronoEngineWizard are configured to put the .exe file into your ChronoEngine\bin\Win32_VisualStudio\ directory, together with all other Chrono::Engine demos. There is a reason for this: some programs based on Irrlicht will need to load textures and skybox maps, which are saved in the directory ChronoEngine\bin\data, so this choice is more efficient in terms of resources (anyway, you can still modify the output directory of the project, if you don't like this setting).
  • What happens if you choose not to use Irrlicht, in the wizard setting window? There are no problems: a simple console application is created as a template; of course you won't see the 3D simulation of the pendulum as in the picture above, you will just see some basic text output.
Personal tools