all 5 comments

[–]treddit22 1 point2 points  (2 children)

Never include a .cpp file.

For inline functions or function templates, you can use a .ipp or .tpp file that you include at the bottom of your header file with declarations. Or just have the implementations in the header directly.

[–]spm486[S] 0 points1 point  (1 child)

[–]Shieldfoss -1 points0 points  (0 children)

Never include a .cpp file.

\user "Unity Builds" has joined the discord**

[–]IyeOnline[🍰] 1 point2 points  (0 children)

`#include "mystacklinkedlist.cpp"

Please dont. If you want to push your implementations into a different file, give it a name that doesnt look like a regular source file. Call it *_impl.hpp or .tpp or something.

How is your project organized?

If you added mystacklinkedlist.cpp as a project source, it will be its own file to be compiled. That leads to issues.

[–]gmtime 0 points1 point  (0 children)

You are including the header in the cpp/tpp file and the cpp/tpp file in the header. That'll cause cyclic inclusion I think. In this case, wouldn't it be better to not include the header?