Eclipse C++ including header file from my source folder

前端 未结 2 1664
刺人心
刺人心 2020-12-24 09:52

I\'m pretty new to C++ and Eclipse in general so I apologise if I\'m missing something fairly obvious.

The problem I\'m having is that I\'m trying to include a heade

2条回答
  •  我在风中等你
    2020-12-24 10:31

    When you create subfolders in your src folder then each cpp file is compiled in that folder it is located in. Thus, any "" includes need to specify the relative path to get from that folder to another.

    In your case, to get from inside the FileInOut folder you need to go back one level and then into the Statistics folder

    eg

    #include "../Statistics/Statistics.h"
    

    Another alternative is, if you are keeping your includes in your src directory, to add the src directory to the include path. Now when you include you need only specify the path from the src root.

    eg.

    #include "Statistics/Statistics.h"
    

提交回复
热议问题