- Jun 7, 2000
- 481
- 0
- 0
I am writing my first homework that involves modules. We had written the program before just using different functions, but now since we are studying modules it has to include those. The problem that I am having is that the global varialbes that I declare (outside of main, in the client file):
const int MaxLength = 15;
const int MaxWords = 44;
const int MaxFileName = 30;
are not global to all of the seperate files correct? (2 other .h and .cpp files)
I tried creating the same variable declerations in the .h files with "extern" in front of them, but i am still getting error messages like this:
expected constant expression
cannot allocate an array of constant size 0
'<Unknown>' : missing subscript
These all have to do with arrays in the other 2 .cpp files try to access the global variables set in main.
So basically I need to know how/where to re-declare (if i need to) these global varialbes so that my other modules can have access to them.
Thanks for any help, and I hope my question is somewhat understandable.
const int MaxLength = 15;
const int MaxWords = 44;
const int MaxFileName = 30;
are not global to all of the seperate files correct? (2 other .h and .cpp files)
I tried creating the same variable declerations in the .h files with "extern" in front of them, but i am still getting error messages like this:
expected constant expression
cannot allocate an array of constant size 0
'<Unknown>' : missing subscript
These all have to do with arrays in the other 2 .cpp files try to access the global variables set in main.
So basically I need to know how/where to re-declare (if i need to) these global varialbes so that my other modules can have access to them.
Thanks for any help, and I hope my question is somewhat understandable.
