How to create a new openFrameworks Project with Visual Studio 2010


OpenFrameworks is a cool toolkit for creative coding in c++. Some really cool stuff has been made in it. Getting started with it is pretty easy, but there a couple little things that if missed can make working with it a real head ache. Since I had some hangups with getting it working when I first started, I thought I would share a step by step guide on how I start new openFrameworks projects for use with Visual Studio 2010.

1. Download and install openFrameworks

If you haven’t got it already, head over to their download page at and click on the link for Windows -> Visual Studio 2010 (direct link). For reference I am working with version 0071

Once it is downloaded extract the files to any location you want (For instance, I extract mine to: C:\Projects\of_v0071_vs2010_release)

I am not sure if it is just me but whenever I extract this, the folder comes out green. This apparently means that the folder is encrypted. This has caused me problems in the past so I would recommend that you right click on the folder and select Properties. In the window that comes up uncheck Read-only from the Attributes section and then click the Advanced button. In this window just uncheck Encrypt contents to secure data and then hit OK on the dialogs to dismiss them. If it asks, you want to Apply changes to this folder, subfolders and files.

2. Copy an example project

Most of the time when I want to start a new project I just hop into Visual Studio and select File -> New -> Project and select the type of project from the handy dandy window that comes up. Sadly, this really isn’t the way to go for openFrameworks projects. Instead it seems the easiest thing to do is to copy and paste one the existing sample projects and rename it.

One very important thing to note is that when you copy a project the destination must be  in a folder that is an equal number of sub directories down from the main openFrameworks folder. You must do this because all the paths for things like includes and library files and whatnot are specified with relative paths like: ..\..\..\addons\ofxOpenCv\lib. If you are at a different level in the folder structure the compiler won’t be able to find any of these things and you will get a million compiler errors. Long story short, if you copy the example project to C:\…\of_v0071_vs2010_release\apps\myApps you will be fine.

The example projects are located at C:\…\of_v0071_vs2010_release\examples. You can choose which project you want to copy but I would recommend the allAddonsExample folder that is inside examples\addons to start with so you won’t have to mess with adding anything to your project later on.

So copy C:\temp\of_v0071_vs2010_release\examples\addons\allAddonsExample to C:\temp\of_v0071_vs2010_release\apps\myApps

3. Rename the project

At this point you have your project in its final resting place, and you should be able to open the Solution file in Visual Studio 2010, build and run it without any problems. But you probably want to rename the project to something more specific than “allAddonsExample”. For example, I am going to rename mine to MyAwesomeProject

First, rename the folder from allAddonsExample to MyAwesomeProject

Next rename the following files in the root folder by replacing “allAddonsExample” with “MyAwesomeProject”:

  • allAddonsExample.sdf
  • allAddonsExample.sln
  • allAddonsExample.suo
  • allAddonsExample.vcxproj
  • allAddonsExample.vcxproj.filters
  • allAddonsExample.vcxproj.user

This means that allAddonsExample.vcxproj.filters will be renamed to MyAwesomeProject.vcxproj.filters. Just make sure you only replace the name portion and leave the extension(s) alone (I mention it because when you rename inside Windows Explorer it will automatically select everything up to the last extension and it is easy to accidentally delete everything)

Next we need to alter the solution file just a tad. Open MyAwesomeProject.sln in your preferred text editor (Notepad++ is awesome for this sort of thing) Just find and replace all mentions of allAddonsExample to MyAwesomeProject. Should just be the two instances on line 3 of the file that specify the project name and path. Save and close your editor

4. Open in Visual Studio 2010 and Enjoy

That is it. Now you have a new project that you can play with until your heart is content. Just open the solution file in Visual Studio 2010 and give it a test run. Assuming everything builds properly you should be greeted with a ugly gray window. That ugly gray window is the blank canvas upon which your masterpiece will be born.

If you know of a better way to get a new project going, please let me know in the comments.

3 thoughts on “How to create a new openFrameworks Project with Visual Studio 2010

  1. […] and are going to be using Visual Studio 2010 to do your programming I have a small write up to help here. If your not using Visual Studio check out their download page for […]

  2. I just started using oF and this was really helpful! Thanks!

  3. Ram says:

    No comment has been made for ages it seems anyway here is my ques…ur method works and i happily build and run the solution but how can i change the source code i have no idea…there is no c++ file to change….how can i get the source code from the solution please help…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: