@batchku wrote:
I'm having a difficult time finding a working solution for accessing a variable defined in
ofApp.cpp
andofApp.h
in another class. The variety of solutions i've research and tried produce a variety of compiler or linker errors.Here are the techniques i've tried:
- using theextern
keyword to define the define the variable inofApp.h
, assign a value to it inofApp.cpp
and the try to use it inmyClass.cpp
(which has#include ofApp.h
) but the name is not recognized. (like this)
- creating aget
method in ofApp.cpp, and trying to call that method from 'myClass.cpp. Only works if the get method is
static, but then the
static` method can not access variables defined in the offApp classI'm able to use a header file with lots of constants, defined with
#define
but I need a way to access variables that change values across multiple files.Any hints/pointers would be much appreciated!
I'm working with OF 0.98 and XCode 8.2.1.
Posts: 9
Participants: 2