Creating a Windows project from scratch in Cinder is not too difficult. Visual C++ offers tremendous flexibility in how users can structure their projects, and this guide will show you how to setup a project similarly to the samples. However Cinder is designed to be flexible and you should feel free to adapt things to your preferences.
Let's start in Windows Explorer. We'll create a folder for our project, and inside that a folder for source code called src.
Now open up Visual C++, and from the File menu select New Project. In the dialog box, select Win32 Project from the Win32 category.
Tell Visual C++ to save the project in the project folder we created earlier. In the following options dialog box, make sure to specify creating an empty project.
At this point we would recommend closing your project in Visual C++, and then locating your project in the Explorer. Rename the folder named after your project (and housing your.vcproj) to vc9. This is certainly optional, but can simplify the eventual possibility of your project accomodating other compilers or operating systems.
Now open your project back up in Visual C++. We'll create our first .cpp file by right-clicking on the Source folder and selecting Add | New Item... Specify the destination as the src folder we created earlier.
For the purposes of this guide, we'll just copy and paste the code from cinder/samples/basicApp/src/basicApp.cpp as a starting point for this project.
At this point if you were to try to build your project, you'll get a number of compile errors due to Visual C++ not being able to find Cinder, so let's point it at the right places for finding its headers and libraries. Under the Project menu, select Properties. Go to the Build tab and in the Configuration popup in the window's upper left corner, select All Configurations. Under the C/C++ section select the General category. Now modify the Additional Include Directories and set it to be <path to cinder>\include; <path to cinder>\boost
You'll need to modify the following settings in a similar fashion.
Category | Setting | Value |
All Configurations: C/C++ | General |
Additional Include Directories | <path to Cinder>\include;<path to Cinder>\boost |
All Configurations: Linker | General |
Additional Library Directories | <path to Cinder>\lib;<path to Cinder>\lib\msw |
Debug: Linker | Input |
Additional Dependencies | cinder_d.lib |
Release: Linker | Input |
Additional Dependencies | cinder.lib |
Debug: C/C++ | Code Generation |
Runtime Library | Multi-threaded Debug (/MTd) |
Release: C/C++ | Code Generation |
Runtime Library | Multi-threaded (/MT) |
All Configurations: Linker | Advanced |
Data Execution Prevention (DEP) | Image is not compatible with DEP (/NXCOMPAT:NO) |