Declare array in C++ header and define it in cpp file?

后端 未结 7 2098
攒了一身酷
攒了一身酷 2020-12-15 04:13

This is probably a really simple thing but I\'m new to C++ so need help.

I just want to declare an array in my C++ header file like:

int lettersArr[2         


        
7条回答
  •  难免孤独
    2020-12-15 04:39

    Change what you have in the header to:

    extern int lettersArr[26];
    

    so that it will become a declaration, not a definition.

提交回复
热议问题