CodeBlocks not building my project

前端 未结 2 1794
孤城傲影
孤城傲影 2021-01-28 07:14

Every time I click the \'run\' or \'build and run\' options in CodeBlocks for Mac OSX I get this dialogue:

\"enter

2条回答
  •  忘了有多久
    2021-01-28 07:40

    It's because you define the variable anArray in the header file. When its included in two translation units it's defined twice, giving you the duplicate symbol error.

    Just declare it in the header file

    extern int anMyArray[9];
    

    and define it in one (and only one) source file.

提交回复
热议问题