class Config
{
public:
static int OUTPUT_TO_FILE;
static int NEED_TO_TRAIN;
static int NO_FILE_TRAIN;
static int NEED_TO_TEST;
}
Above is my header.h file (i followed: http://weblogs.asp.net/whaggard/archive/2004/11/05/252685.aspx)
and I want to be able to do things like Config.OUTPUT_TO_FILE = true or variable = Config.NO_FILE_TRAIN;
from any file that includes config.h
I have what I want to do is clear, Just want some variable shared throughout all my cpp files.
EDIT: I'm having trouble compiling:
In my make file, I added:
hPif : src/main.o src/fann_utils.o src/hashes.o src/config.o # added the config part
g++ src/main.o src/fann_utils.o src/hashes.o src/config.o -lfann -L/usr/local/lib -o hPif
config.o : src/config.cpp src/config.h
g++ -c src/config.cpp
.
.
.
main.o: src/main.cpp src/config.h src/main.h src/hashes.h
g++ -c src/main.cpp
config.cpp:
#include "config.h"
int OUTPUT_TO_FILE = false;
.
.
.
config.h:
class Config
{
public:
static int OUTPUT_TO_FILE;
.
.
.
Trying to call by:
#include "config.h"
...
Config::OUTPUT_TO_FILE = true;
Error I get:
Undefined Symbols:
"Config::OUTPUT_TO_FILE", referenced from:
_main in main.o
_main in main.o