This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

strange error

Hello all,

Can anyone tell me why I am receiving the following error:

[Warning] xxxxxxxx.h(14): Wxxxx Cannot create pre-complled header: initialized data in header

in the following line:

const char ConstFileExtCommon[] = "Txt";

  • Why? Well, because you cannot create pre-compiled headers having initialized data in the header and the line you posted attempts to do that.

  • The reason is precisely what the message says. That line contains an initialized variable definition, which is, and clearly must be, forbidden in a precompiled header.

    Actually, that line should not ever be in a header in the first place. Headers should contain declarations, not definitions.

    So the solution is: Don't do that.