Reputation: 11
The project all together is a game engine. However, for this aspect I am trying to add a development tool that uses SFML to display a graph. I have successfully linked SFML to get it working on its own. The problem occurs when I try to #include the header from the tool into another project within the solution. I get an error saying the graphics.hpp in the SFML library cannot be found. I am using a premake5.lua file to statically link SFML.
Any help would be much appreciated.
Here is the segment of code for the premake. The .bat file can't build if I try to include the SFML into the sandbox project.
project "Sandbox"
location "sandbox"
kind "ConsoleApp"
language "C++"
staticruntime "off"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("build/" .. outputdir .. "/%{prj.name}")
files {
"%{prj.name}/include/**.h",
"%{prj.name}/src/**.cpp",
"vendor/stb_image/stb_image.cpp"
}
includedirs {
"%{prj.name}/include",
"engine/enginecode/",
"engine/enginecode/include/independent",
"engine/precompiled/",
"vendor/glm/",
"vendor/spdlog/include",
"vendor/json/single_include/nlohmann",
"vendor/IMAT3904/include",
"vendor/IMAT3904/include/include/independent",
"vendor/React3D/src"
"vendor/SFML-2.5.1/lib"
}
links {
"Engine",
"React3D",
}
filter "system:windows"
cppdialect "C++17"
systemversion "latest"
defines {
"NG_PLATFORM_WINDOWS"
}
filter "configurations:Debug"
defines {
"NG_DEBUG"
"SFML_STATIC"
}
runtime "Debug"
symbols "On"
libdirs {
"vendor/SFML-2.5.1/lib"
}
links {
"sfml-main",
"sfml-graphics-s-d",
"sfml-system-s-d",
"sfml-window-s-d",
"sfml-audio-s-d",
"opengl32.lib",
"winmm.lib",
"gdi32.lib",
"openal32.lib",
"flac.lib",
"vorbisenc.lib",
"vorbisfile.lib",
"vorbis.lib",
"ogg.lib",
"freetype.lib"
}
debugenvs {"PATH=$PATH;../vendor/SFML-2.5.1/bin;"}
filter "configurations:Release"
defines {
"NG_RELEASE"
"SFML_STATIC"
}
runtime "Release"
optimize "On"
libdirs {
"vendor/SFML-2.5.1/lib"
}
links {
"sfml-main",
"sfml-graphics-s",
"sfml-system-s",
"sfml-window-s",
"sfml-audio-s",
"opengl32.lib",
"winmm.lib",
"gdi32.lib",
"openal32.lib",
"flac.lib",
"vorbisenc.lib",
"vorbisfile.lib",
"vorbis.lib",
"ogg.lib",
"freetype.lib"
}
debugenvs {"PATH=$PATH;../vendor/SFML-2.5.1/bin;"}
project "ProfilingTool" location "ProfilingTool" kind "ConsoleApp" language "C++" staticruntime "off"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("build/" .. outputdir .. "/%{prj.name}")
files {
"%{prj.name}/include/**.h",
"%{prj.name}/src/**.cpp"
}
includedirs {
"%{prj.name}/include",
"vendor/spdlog/include",
"vendor/stb_image",
"vendor/freetype2/include",
"vendor/glm/",
"vendor/assimp/include",
"vendor/Glad/include",
"vendor/glfw/include",
"vendor/json/single_include/nlohmann",
"vendor/IMAT3904/include",
"vendor/SFML-2.5.1/include"
}
filter "system:windows"
cppdialect "C++17"
systemversion "latest"
filter "configurations:Debug"
runtime "Debug"
symbols "On"
defines "SFML_STATIC"
libdirs {
"vendor/SFML-2.5.1/lib"
}
links {
"sfml-main",
"sfml-graphics-s-d",
"sfml-system-s-d",
"sfml-window-s-d",
"sfml-audio-s-d",
"opengl32.lib",
"winmm.lib",
"gdi32.lib",
"openal32.lib",
"flac.lib",
"vorbisenc.lib",
"vorbisfile.lib",
"vorbis.lib",
"ogg.lib",
"freetype.lib"
}
debugenvs {"PATH=$PATH;../vendor/SFML-2.5.1/bin;"}
filter "configurations:Release"
runtime "Release"
optimize "On"
defines "SFML_STATIC"
libdirs {
"vendor/SFML-2.5.1/lib"
}
links {
"sfml-main",
"sfml-graphics-s",
"sfml-system-s",
"sfml-window-s",
"sfml-audio-s",
"opengl32.lib",
"winmm.lib",
"gdi32.lib",
"openal32.lib",
"flac.lib",
"vorbisenc.lib",
"vorbisfile.lib",
"vorbis.lib",
"ogg.lib",
"freetype.lib"
}
debugenvs {"PATH=$PATH;../vendor/SFML-2.5.1/bin;"}
It does include SFML for the profiling tool but not for the sandbox project.
Upvotes: 1
Views: 666
Reputation: 1509
In your sandbox you have this as includedir: "vendor/SFML-2.5.1/lib"
, that should probably be: "vendor/SFML-2.5.1/include"
Upvotes: 0