我想使用glslang和SPIRV库进行在线glsl转换和spirv生成,我能够通过cmake生成项目文件,并且能够成功构建glslang.sln项目,构建过程产生了所有必需的库以及可执行文件,但是当我设置VS项目并尝试链接glslang和SPIRV时,出现以下链接错误:
Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol "public: void __cdecl
shader::initializeResources(struct TBuiltInResource &)" (? initializeResources@shader@@QEAAXAEAUTBuiltInResource@@@Z) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\shader.obj 1
Error LNK2001 unresolved external symbol spvContextCreate glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol spvContextDestroy glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol spvValidatorOptionsCreate glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol spvValidatorOptionsDestroy glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol spvValidatorOptionsSetBeforeHlslLegalization glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol spvValidatorOptionsSetRelaxBlockLayout glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol spvOptimizerOptionsCreate glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol spvOptimizerOptionsDestroy glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol spvOptimizerOptionsSetRunValidator glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol spvBinaryToText glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol spvValidateWithOptions glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol spvDiagnosticDestroy glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol spvDiagnosticPrint glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "public: __cdecl spvtools::Optimizer::PassToken::~PassToken(void)" (??1PassToken@Optimizer@spvtools@@QEAA@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "public: __cdecl spvtools::Optimizer::Optimizer(enum spv_target_env)" (??0Optimizer@spvtools@@QEAA@W4spv_target_env@@@Z) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "public: __cdecl spvtools::Optimizer::~Optimizer(void)" (??1Optimizer@spvtools@@QEAA@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "public: void __cdecl spvtools::Optimizer::SetMessageConsumer(class std::function<void __cdecl(enum spv_message_level_t,char const *,struct spv_position_t const &,char const *)>)" (?SetMessageConsumer@Optimizer@spvtools@@QEAAXV?$function@$$A6AXW4spv_message_level_t@@PEBDAEBUspv_position_t@@1@Z@std@@@Z) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "public: class spvtools::Optimizer & __cdecl spvtools::Optimizer::RegisterPass(struct spvtools::Optimizer::PassToken &&)" (?RegisterPass@Optimizer@spvtools@@QEAAAEAV12@$$QEAUPassToken@12@@Z) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "public: bool __cdecl spvtools::Optimizer::Run(unsigned int const *,unsigned __int64,class std::vector<unsigned int,class std::allocator<unsigned int> > *,struct spv_optimizer_options_t * const)const " (?Run@Optimizer@spvtools@@QEBA_NPEBI_KPEAV?$vector@IV?$allocator@I@std@@@std@@QEAUspv_optimizer_options_t@@@Z) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateEliminateDeadFunctionsPass(void)" (?CreateEliminateDeadFunctionsPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateBlockMergePass(void)" (?CreateBlockMergePass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateInlineExhaustivePass(void)" (?CreateInlineExhaustivePass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateLocalSingleBlockLoadStoreElimPass(void)" (?CreateLocalSingleBlockLoadStoreElimPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateDeadBranchElimPass(void)" (?CreateDeadBranchElimPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateLocalMultiStoreElimPass(void)" (?CreateLocalMultiStoreElimPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateLocalAccessChainConvertPass(void)" (?CreateLocalAccessChainConvertPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateLocalSingleStoreElimPass(void)" (?CreateLocalSingleStoreElimPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateDeadInsertElimPass(void)" (?CreateDeadInsertElimPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateAggressiveDCEPass(void)" (?CreateAggressiveDCEPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreatePropagateLineInfoPass(void)" (?CreatePropagateLineInfoPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateRedundantLineInfoElimPass(void)" (?CreateRedundantLineInfoElimPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateCFGCleanupPass(void)" (?CreateCFGCleanupPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateMergeReturnPass(void)" (?CreateMergeReturnPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateRedundancyEliminationPass(void)" (?CreateRedundancyEliminationPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateScalarReplacementPass(unsigned int)" (?CreateScalarReplacementPass@spvtools@@YA?AUPassToken@Optimizer@1@I@Z) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateIfConversionPass(void)" (?CreateIfConversionPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateSimplificationPass(void)" (?CreateSimplificationPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK2001 unresolved external symbol "struct spvtools::Optimizer::PassToken __cdecl spvtools::CreateVectorDCEPass(void)" (?CreateVectorDCEPass@spvtools@@YA?AUPassToken@Optimizer@1@XZ) glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\glslang-TO-SPV\SPIRV.lib(SpvTools.obj) 1
Error LNK1120 39 unresolved externals glslang-TO-SPV C:\Users\Zirian\source\repos\glslang-TO-SPV\x64\Release\glslang-TO-SPV.exe 1
我正在使用的库是SPIRV.lib glslang.lib OGLCompiler.lib OSDependent.lib HLSL.lib
我的库文件夹包含以下库:
Iam使用VS 2019平台x64