当我将这个特定的.hpp包含在我使用相同(复制粘贴)项目设置(包括路径,链接器路径等)的测试项目的标题中时,所有内容都编译得很好。但是出于某种原因,当我尝试从头文件层次结构深处的文件中包含它时,我的项目将无法编译。标题有警卫。
这是日志:
C:\WINDOWS\system32\cmd.exe /C ""C:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-make.exe" -j4 SHELL=cmd.exe -e -f Makefile"
"----------Building project:[ Rogue - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'E:/CPP/Rogue/Rogue'
codelite-cc "C:/Program Files (x86)/CodeBlocks/MinGW/bin/g++.exe" -g -O0 -std=c++17 -std=c++14 -std=c++11 -Wall Char.cpp -o Char
In file included from Item.h:7:0, //this says ' #include "Entity.h" '
from Char.h:12, //this says ' #include "Item.h" '
from Char.cpp:1:
Entity.h:5:29: fatal error: SFML/Graphics.hpp: No such file or directory
compilation terminated.
mingw32-make.exe[1]: *** [Char] Error 1
<builtin>: recipe for target 'Char' failed
mingw32-make.exe[1]: Leaving directory 'E:/CPP/Rogue/Rogue'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
====3 errors, 1 warnings====
这是我的header "hierarchy"。 (A.h - &gt; B.h表示A#包括B)
defs.h和utils.h在类别上是无关的(它们分别包含#defines和utility函数。)
我的编译器设置:
SFML安装在E:/ CPP / Libs / SFML
中该项目位于E:/ CPP / Rogue
据我所知,没有环境变量。