Fixing #includes <> for GCC (Code::Blocks)

前端 未结 4 790
半阙折子戏
半阙折子戏 2021-01-13 17:58

I am working with some code that was written for a different compiler/linker, and it is including files like this:

#include 
         


        
4条回答
  •  梦谈多话
    2021-01-13 18:21

    Probably you should write

    #include "Engine/Graphics/Sprite.h"
    

    (notice the double quotes instead of the brackets).

    In #include directives brackets are used to specify that you want to include a system/library header file, that will be searched in the system includes directory (e.g. /usr/include), while the double quotes are used to include files in the current path.

    This should work if the files that use this #include are in the directory that contains the Engine/... hierarchy. If that's not the case, you should also specify it to the compiler as an additional include directory, with the -I directive.

提交回复
热议问题