Valkyrie Savage
Valkyrie Savage

Reputation: 615

can I call an app in OpenFrameworks something other than testApp?

I am working with OpenFrameworks for the first time (I am also rusty at C++).

I am trying to build an app with OFX, and I want to call my app something other than testApp. I am building off the openCVExample code, and I've replaced testApp everywhere with the new name and moved the files from testApp.{h,cpp} to newname.{h,cpp}.

However, when I try to build (using Microsoft Visual C++ 2010 Express, if that makes a difference) I see that the testApp.cpp file is being generated with the contents of newname.cpp and put into my src/ folder. I'm also getting griped at by the build saying that testApp isn't a valid namespace on all lines in newname.cpp where I am trying to call or define member functions (I am using newname::functionName).

I've looked at the build commandline, and it doesn't seem to be looking for testApp.cpp; I've also looked through the linker and other stuff, but don't see it mentioned anywhere in there. Is this some bizarre feature of OpenFrameworks?

Upvotes: 1

Views: 342

Answers (2)

Emile
Emile

Reputation: 11721

In the openframeworks directory there is a project creator app that will do this for you.

D:\workspace\of_v0073_vs2010_release\projectGenerator\projectGenerator.exe

It will also setup addons you've downloaded.

Note:: It creates solutions for VS 2010, i assume this can be opened by Express?

Upvotes: 1

admsyn
admsyn

Reputation: 1461

You'll need to change the instances of "testApp" to "newname" in a handful of places:

  1. In testApp.h you'll need to change your app's class name. This is probably the 5th line, which looks like class testApp : public ofBaseApp

  2. In testApp.cpp, you'll need to change all of the function definitions to use the "newname" namespace. These are all of the lines which look like void testApp::setup()

  3. In main.cpp, you'll need to change the argument in ofRunApp() from new testApp() to new newname()

You actually don't have to change the names of the files from testApp.{h,cpp}, though it's still a good idea from an organization standpoint.

Upvotes: 0

Related Questions