B
Bruintje Beer
Hello,
I have an include file constants.h see below. Later I want to include this
header file in two c++ source files because they both need the variables f1,
f2 and f3. At link time I got an error that f1, f2 and f3 are alread defined
in one of the c++ source files. How can I change my code so both c++ source
files can have access to the fields f1, f2 and f3.
John
#ifndef __CONSTANTS_H
#define __CONSTANTS_H
namespace demo
{
const char* f1 = "field_1";
const char* f2 = "field_2";
const char* f3 = "field_3";
}
#endif
I have an include file constants.h see below. Later I want to include this
header file in two c++ source files because they both need the variables f1,
f2 and f3. At link time I got an error that f1, f2 and f3 are alread defined
in one of the c++ source files. How can I change my code so both c++ source
files can have access to the fields f1, f2 and f3.
John
#ifndef __CONSTANTS_H
#define __CONSTANTS_H
namespace demo
{
const char* f1 = "field_1";
const char* f2 = "field_2";
const char* f3 = "field_3";
}
#endif