KhronosGroup / SPIRV-Cross

SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
Apache License 2.0
2.08k stars 567 forks source link

[ERROR] Compiling on VS2019 #1820

Open abhra2020-smart opened 2 years ago

abhra2020-smart commented 2 years ago

I get:

1>Hazel.lib(OpenGLShader.obj) : error LNK2001: unresolved external symbol "protected: virtual class std::basic_string<char,struct std::char_traits,class std::allocator > cdecl spirv_cross::CompilerGLSL::constant_op_expression(struct spirv_cross::SPIRConstantOp const &)" (?constant_op_expression@CompilerGLSL@spirv_cross@@MEAA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBUSPIRConstantOp@2@@Z) 1>Hazel.lib(OpenGLShader.obj) : error LNK2001: unresolved external symbol "protected: virtual bool cdecl spirv_cross::CompilerGLSL::variable_decl_is_remapped_storage(struct spirv_cross::SPIRVariable const &,enum spv::StorageClass)const " (?variable_decl_is_remapped_storage@CompilerGLSL@spirv_cross@@MEBA_NAEBUSPIRVariable@2@W4StorageClass@spv@@@Z) 1>Hazel.lib(OpenGLShader.obj) : error LNK2001: unresolved external symbol "protected: virtual bool cdecl spirv_cross::CompilerGLSL::access_chain_needs_stage_io_builtin_translation(unsigned int)" (?access_chain_needs_stage_io_builtin_translation@CompilerGLSL@spirv_cross@@MEAA_NI@Z) 1>Hazel.lib(OpenGLShader.obj) : error LNK2001: unresolved external symbol "protected: virtual void cdecl spirv_cross::CompilerGLSL::emit_array_copy(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,unsigned int,unsigned int,enum spv::StorageClass,enum spv::StorageClass)" (?emit_array_copy@CompilerGLSL@spirv_cross@@MEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IIW4StorageClass@spv@@1@Z) 1>Hazel.lib(OpenGLShader.obj) : error LNK2001: unresolved external symbol "protected: virtual void __cdecl spirv_cross::CompilerGLSL::cast_to_variable_store(unsigned int,class std::basic_string<char,struct std::char_traits,class std::allocator > &,struct spirv_cross::SPIRType const &)" (?cast_to_variable_store@CompilerGLSL@spirv_cross@@MEAAXIAEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBUSPIRType@2@@Z) 1>Hazel.lib(OpenGLShader.obj) : error LNK2001: unresolved external symbol "protected: virtual void __cdecl spirv_cross::CompilerGLSL::cast_from_variable_load(unsigned int,class std::basic_string<char,struct std::char_traits,class std::allocator > &,struct spirv_cross::SPIRType const &)" (?cast_from_variable_load@CompilerGLSL@spirv_cross@@MEAAXIAEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBUSPIRType@2@@Z) 1>..\bin\Release-windows-x86_64\Hazelnut\Hazelnut.exe : fatal error LNK1120: 6 unresolved externals 1>Done building project "Hazelnut.vcxproj" -- FAILED.

while building Hazel.

HansKristian-Work commented 2 years ago

We don't reproduce this on CI. Is this using the CMake build system? I don't know what Hazel is.

Kir1n commented 1 year ago

hello, how did you solve this problem, I have been taken so many times on it QAQ

shadowndacorner commented 1 year ago

@abhra2020-smart @Kir1n For me, this was a case of accidentally including spirv_cross/spirv_cross.hpp rather than spirv_cross.hpp. This resulted in me using the headers for my Vulkan SDK install rather than using the spirv-cross I was compiling as part of CMake.

sak9188 commented 3 weeks ago

@abhra2020-smart @Kir1n For me, this was a case of accidentally including spirv_cross/spirv_cross.hpp rather than spirv_cross.hpp. This resulted in me using the headers for my Vulkan SDK install rather than using the spirv-cross I was compiling as part of CMake.

You are right!