Answer the question
In order to leave comments, you need to log in
External constant in header?
Why is it not possible to use extern const in headers if the header itself is not included in the .cpp file?
For example:
MyVar.h extern const int AnyVar ;
MyVar.cpp const int AnyVar = 475 ;
main.cpp
#include"MyVar.h"
int main()
{
int test = AnyVar ; // ошибка
}
#include"MyVar.h"
, then everything works fine. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question