How can I avoid including class implementation files?

前端 未结 7 867
轮回少年
轮回少年 2020-11-29 11:45

Instead of doing

#include \"MyClass.cpp\"

I would like to do

#include \"MyClass.h\"

I\'ve read online tha

7条回答
  •  臣服心动
    2020-11-29 12:27

    You should not include a source file (.c or .cpp). Instead you should include the corresponding header file(.h) containing the declarations. The source files needs to be compiled separately and linked together to get the final executable.

提交回复
热议问题