Search code examples
c++visual-studioopengllinkerglad

how do I properly link GLAD to my project


I am making a small game engine in Visual Studio. As far as I am aware I have everything linked correctly, but I am still generating this in the .log file

Creating library C:\dev\Gluten\Gluten\bin\x64\Release\Gluten.lib and object C:\dev\Gluten\Gluten\bin\x64\Release\Gluten.exp
WindowsWindow.obj : error LNK2001: unresolved external symbol gladLoadGLLoader
C:\dev\Gluten\Gluten\bin\x64\Release\Gluten.dll : fatal error LNK1120: 1 unresolved externals

Here is my Additional Include Directories

$(SolutionDir)Gluten\vendor\GLAD\include\

My Additional Libraries

$(SolutionDir)Gluten\vendor\GLAD\lib\

And I am including glad.lib in my linker input

This is my project structure

enter image description here


Solution

  • I suggest you should add the glad.c to your solution.

    Go to Visual Studio > Solution Explorer > Source Files > Add > Existing Item.

    Visual Studio will not automatically recognize the file if you drag 'glad.c' file and drop it into the Source Files.