Question: OF internal structure compared to Processing?

Following a basic openFrameworks tutorial recently, I innocently decided to add a new class by using Visual Studio project menu commands Add > Class. My responses added .cpp and .h files but referencing them in ofApp.cpp or ofApp.h caused a “not found” error.

A plea for help brought kind responses which, in essence, require the user to create new class files outside VS then bring them into the project folder and use the “Add Existing Item” to accomplish integration into the project.That seems kind of painful.

This thread is where the conversation took place:

Basic VS question: adding new class files

I’m wondering what internal structure of openFrameworks or problem with Visual Studio led to my issue. In Processing I’ve read (if my memory is still good) that its code runs as an “inside class” in Java. Further, if you create apparently separate classes in the Processing development environment tabs, those class definitions are actually appended to the tab containing setup() and draw().

I think that it is just VS cumbersomeness, although I have never faced the problem described. I’ve used VS a lot although I usually work on macos. I cant really recall how I use to make new classes in VS but what I’m sure of is that I’ve never had to create these outside of VS. I’ll take a look later to see how I did this.
cheers

  1. Let me correct my Java reference: I think a Processing Sketch is hooked into its Java host via an inner class not inside class.

  2. The suggestion I received in the original post was simply copy and paste a .cpp and matching .h file right into the new project’s …/src folder. There you can edit file names and contents then start Visual Studio and select that project. You will see your new files but they won’t be part of any “makefile”. So, in Solution Explorer, you can right-click on your project (not openframeworksLib) and invoke Add | Existing Item and select your new files. They should now be visible to ofApp.* and effective in Build references.