我在过去几个小时里一直试图解决一个我无法摆脱的错误。这是要点:https://gist.github.com/pluralism/11294490
我没有想法,因为一切对我来说都是正确的。我得到的编译错误如下:
1>MenuCAL.obj : error LNK2005: "void __cdecl printSquareArray(int * *,unsigned int)" (?printSquareArray@@YAXPAPAHI@Z) already defined in calproject.obj 1>C:\Users\Andre Pinheiro\Desktop\calproject\Debug\calproject.exe : fatal error LNK1169: one or more multiply defined symbols found
如果您需要其他文件,请随时提出。提前谢谢!
答案 0 :(得分:4)
如果您想在标头中定义printSquareArray
,请将其标记为inline
,以允许每个包含标题的翻译单元中的定义。
或者,将定义移动到源文件中,因此只定义一次。