clang complaint on missing previous extern


  • Moderators

    In my code I have found the warning below for the declaration of a global variable.

    0_1533659682876_aec6451d-c726-4067-a203-26dcfed0aabb-image.png

    I know the drawbacks of global variables and use them scarcely. I have the variable also in another cpp file with an extern, but not here.
    IIRC in early times we could/did not initialize immediately, but that is handy and avoids duplication. The statement above has been introduced just to check if one of the examples found by google from tutorials will be digested without warning by cland model. However, see yourself.

    I do not really see what I should do differently?
    Certainly I can make it part of a class and declare as static,but sounds odd to me.

    For those fellows checking it out.
    I am on windows 10 64 bit
    Creator is released 4.7.0
    Code model is also for 4.7.0


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.