Saturday, November 8, 2008

Where to define your global variables?

In C/C++ project, where to define the global variables is a question. If you define them in the header file, you may encounter the link2005 error about objects redefined.

The formal way to define global variables is to define them in C or CPP file, and declare them in the header file by using extern keyword.

No comments: