C++ include and redefinition of class error

前端 未结 3 2073
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-14 19:36

I am currently programming a program which searches song according to diffrent parameters. In my system there are 2 types of songs: lyric and instrumetal. Since i need to p

3条回答
  •  佛祖请我去吃肉
    2021-01-14 20:14

    You have to tell preprocessor to include your header files only once. You can achieve by adding #pragma once on the top of all *.h files:

    #pragma once
    
    //Your header file's code
    

    It is also a good practice to always begin header files with this line.

提交回复
热议问题