0

In my .hpp file I have

extern const double MY_CONST[44];

and in my .cpp file I have

const double MY_CONST[44];

and I get something like this:

error: uninitialized const 'MY_CONST' [-fpermissive]

Could you please tell me where the error is? Thanks

1 Answer 1

1

Remember that const object must be initialized. You can declare them extern, but you must assign them. You may like to do:

const double MY_CONST[44] ={0};

To default initialize them all to zero. But that doesn't mean anything, since they are const (and will always have value 0).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.