Repeated Multiple Definition Errors from including same header in multiple cpps

后端 未结 9 1684
南方客
南方客 2020-11-27 06:12

So, no matter what I seem to do, I cannot seem to avoid having Dev C++ spew out numerous Multiple Definition errors as a result of me including the same header file in multi

9条回答
  •  旧时难觅i
    2020-11-27 06:45

    I too was having this problem some time back. Let me try to explain what solved it. I had a global.h file which had all declaration and need to be included in every cpp file. Instead of including it in every .cpp, I included it in .h. All my ".h" files I have added the lines #ifndef and #define and ended with #endif. This solved MD problem. Hope this works for you too.

提交回复
热议问题