rdalton
April 19th, 2004, 03:23 PM
hello everyone,
I'm having some issues with namespaces and was wondering if anyone new the problem.
First of all I have a namespace with a few global variables and functions like the following.
mynamespace {
HANDLE hMyEvent;
int i;
int j;
void MyFunc1();
void MyFunc2();
}
I have multiple c++ files that use this namespace to access the global data, however I get linking errors from the variables unless I preceede their declaration with "static".
Another big issue I'm facing is that it seems that each file that uses the variables by calling: mynamespace::i = value has their own local copy. That is, when I set an event from the namespace in one file, another file doesn't see these modifications.
the namespacee is defined in mynamespace.h and implemented in mynamespace.cpp.
Files that use the namespace include mynamespace.h and then access the variables or functions by using the namespace name and scope resolution operator, mynamespace::.
Anyone have some ideas for these problems.
Thanks.
rdalton
I'm having some issues with namespaces and was wondering if anyone new the problem.
First of all I have a namespace with a few global variables and functions like the following.
mynamespace {
HANDLE hMyEvent;
int i;
int j;
void MyFunc1();
void MyFunc2();
}
I have multiple c++ files that use this namespace to access the global data, however I get linking errors from the variables unless I preceede their declaration with "static".
Another big issue I'm facing is that it seems that each file that uses the variables by calling: mynamespace::i = value has their own local copy. That is, when I set an event from the namespace in one file, another file doesn't see these modifications.
the namespacee is defined in mynamespace.h and implemented in mynamespace.cpp.
Files that use the namespace include mynamespace.h and then access the variables or functions by using the namespace name and scope resolution operator, mynamespace::.
Anyone have some ideas for these problems.
Thanks.
rdalton