2

I am running into a persistant issue where everytime I call a function from the glad.h file, I get an unresolved external error (LNK2019 in VS 2017).

Here is the code:

#ifndef MAIN
#define MAIN

#include "Dependencies\glad\glad.h"
#include "Dependencies\glfw\glfw3.h"

int main(void){
GLFWwindow* window;

if (!glfwInit())
    return -1;

window = glfwCreateWindow(640, 480, "Test", NULL, NULL);

if (!window)
{
    glfwTerminate();
    return -1;
}

glfwMakeContextCurrent(window);

gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);

glfwDestroyWindow(window);
glfwTerminate();
return 0;
}

#endif

FYI the khrplatform.h is properly included within glad.h

Linker Settings:

img1

img1

img1

For those having the problem : The solution is to include the .c file for GLAD or GLFW

genpfault
  • 51,148
  • 11
  • 85
  • 139
J Cline
  • 77
  • 7
  • `LNK2019` errors are caused almost exclusively by incorrect linker settings, where you've incorrectly specified the object libraries that need to get linked to the resulting executable. Show us what your Linker Settings of your project look like. – Xirema Sep 24 '17 at 03:18
  • @Xirema Added linker settings per request – J Cline Sep 24 '17 at 03:27
  • Can you also show us the folder that `dependencies/glfw` points to? – Xirema Sep 24 '17 at 04:06
  • What is the exact error message you are getting? Which function is missing? – BDL Sep 24 '17 at 07:55
  • @Xirema Added the GLFW dependencies folder. Rabbid76 Yes, the config is applied to all configs and platforms. BDL I found that error when using gladLoadGLLoader. I get a LNK2019 (an obv a LNK1120) with the LNK2019 stating "Unresolved External Symbol _gladLoadGLLoader referenced in function_main – J Cline Sep 24 '17 at 17:28

0 Answers0