当我尝试从网站上整理一个GLSL示例程序时,我得到了这些错误,这样我就可以了解着色器。当我尝试在我自己的程序中实现这个着色器时,我也会得到这些完全相同的错误。
http://www.swiftless.com/tutorials/glsl/1_setup.html#DL
>------ Build started: Project: TheLightingExperiment2, Configuration: Debug Win32 ------
1> main.cpp
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall Shader::init(char const *,char const *)" (?init@Shader@@QAEXPBD0@Z) referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall Shader::unbind(void)" (?unbind@Shader@@QAEXXZ) referenced in function "void __cdecl display(void)" (?display@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall Shader::bind(void)" (?bind@Shader@@QAEXXZ) referenced in function "void __cdecl display(void)" (?display@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall Shader::Shader(void)" (??0Shader@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'shader''(void)" (??__Eshader@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall Shader::~Shader(void)" (??1Shader@@QAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'shader''(void)" (??__Fshader@@YAXXZ)
1>C:\Users\Shawn\Desktop\TheLightingExperiment2\Debug\TheLightingExperiment2.exe : fatal error LNK1120: 5 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
答案 0 :(得分:1)
这些是undefined reference
错误。来自Linker.You没有附加库。在Visual Studio中,您可以通过右键单击解决方案然后转到“属性”来执行此操作。
答案 1 :(得分:0)
看起来你缺少图书馆。查看GLEW GL Extension Wrangler并将其链接到您的项目中。使着色器扩展工作特别有用。