CMakeLists.txt
find_package(Vulkan REQUIRED)
target_link_libraries(${PROJECT_NAME} INTERFACE Vulkan::Vulkan)
int my shader.cpp
void OpenGLShader::Compile(const std::unordered_map<GLenum, std::string>& shaderSources)
{
vk::Buffer;
shaderc::Compiler compiler;
shaderc::CompileOptions options;
}
what iam try to do is testing if this works for shaderc but ima getting these error
out\build\x64-debug\GLContext.lib(OpenGLShader.cpp.obj) : error LNK2019: unresolved external symbol shaderc_compiler_release referenced in function "public: __cdecl shaderc::Compiler::~Compiler(void)" (??1Compiler@shaderc@@QEAA@XZ)
out\build\x64-debug\GLContext.lib(OpenGLShader.cpp.obj) : error LNK2019: unresolved external symbol shaderc_compile_options_initialize referenced in function "public: __cdecl shaderc::CompileOptions::CompileOptions(void)" (??0CompileOptions@shaderc@@QEAA@XZ)
\out\build\x64-debug\GLContext.lib(OpenGLShader.cpp.obj) : error LNK2019: unresolved external symbol shaderc_compile_options_initialize referenced in function "public: __cdecl shaderc::CompileOptions::CompileOptions(void)" (??0CompileOptions@shaderc@@QEAA@XZ)
\out\build\x64-debug\GLContext.lib(OpenGLShader.cpp.obj) : error LNK2019: unresolved external symbol shaderc_compile_options_release referenced in function "public: __cdecl shaderc::CompileOptions::~CompileOptions(void)" (??1CompileOptions@shaderc@@QEAA@XZ)
vk::Buffer;
this work fine but adding shaderc
causes these errors can someone explain me what am i missing
target_link_libraries(${PROJECT_NAME} INTERFACE vulkan-1 shaderc_shared )
worked for me you need to manually add the vulkan using
if (DEFINED VULKAN_SDK_PATH)
set(Vulkan_INCLUDE_DIRS "${VULKAN_SDK_PATH}/Include") # 1.1 Make sure this include path is correct
set(Vulkan_LIBRARIES "${VULKAN_SDK_PATH}/Lib") # 1.2 Make sure lib path is correct
set(Vulkan_FOUND "True")
else()
find_package(Vulkan REQUIRED) # throws error if could not find Vulkan
message(STATUS "Found Vulkan: $ENV{VULKAN_SDK}")
endif()
hope this help is some help to someone