Global variable of own type

Ok, I hope I'll explain my problem clearly :D.
I need to define global variable of my own type, but I don't know where. I am making some Windows Form App in MCVS 2010 and I need something like this:
typedef double t_mat[8][8];
t_mat M={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

(array filled with zeros)
I have put it in its own header file, but I keep getting "error C2374: 'M' : redefinition; multiple initialization" and "du5a_125017\define.h(2) : see declaration of 'M'" (du5a_125017 is name of my project and define.h is that header with typedef)
If I put that second line directly in my Form1.h (after "#pragma endregion"), I get this:
"error C3845: 'DU5A_125017::Form1::M': only static data members can be initialized inside a ref class or value type"
"error C4368: cannot define 'M' as a member of managed 'DU5A_125017::Form1': mixed types are not supported"

I hope I wrote everthing you need to help me :). Thanks.
Why not change the identifier or check if it has already been used?

closed account (3CXz8vqX) ....

typedef double t_mat[][];

Is a 2D array of idea why you need a double. I hope you're aware that an array needs to have a 'constant' array length, in this case, 8x8.

Now, I can't say I'm exactly familiar with 2D arrays...but I'm pretty sure you haven't declared it right. sounds like two files are including the code above... so the header is being called twice and not being excluded if it has detected the other.

Usually along the lines of

if not file.h
include file.h
else do nothing.

I'm not sure if the mixed types is due to you using integers rather than doubles.
Yes, I have had #include "define.h" both in Form1.h and compilation works :).
I need double for mathematical operations on matrix 8x8.
Topic archived. No new replies allowed.