linking files in c( multiple definition of…)

后端 未结 2 1530
醉话见心
醉话见心 2021-01-28 16:33

Im trying to link a few files in c and im getting this erorr: \"multiple definition of createStudentList\"

my main.c:

#include \"students.h\" 

int mai         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-28 17:26

    Remove #include "students.c" from students.h. Because of this the definition is occuring twice - one from students.h and another from students.c - hence the clash.

    Just remove the above mentioned line and also add #include in your students.h. Do these modifications and your code will compile and link fine.

提交回复
热议问题