TLDR: The GLAD header file won't let me use the openGL Commands and I don't know exactly why.
Here's a breakdown:
I'm on a Windows 10 Laptop.
I'm coding in C++.
I'm compiling with MinGW's g++ tool.
I'm using GLFW and GLAD.
My file layout is something like this:
OpenGLTest include glad glad.h GLFW glfw3.h glfw3native.h KHR khrplatform.h glad.c glfw3.dll GraphicsTest.cpp(Main File) libglfw3dll.a(I have forgotten what this does, it's a remnant from older attempts at openGL. Relevant?) Makefile(a single command: "g++ GraphicsTest.cpp -g -L glad.c glfw3.dll")
As far as I can tell, the program will compile and run flawlessly if any and all commands from GLAD and openGL are commented out. All it then does is make a small window.
If said lines are not commented out, the compiler will throw a slew of errors, all following this form:
D:\Documents\Programming\C++\Programs\OpenGLTest/GraphicsTest.cpp:23: undefined reference to `gladLoadGL'
...with gladLoadGL being replaced with the relevant function.
The file itself reads thusly:
#include<iostream> #include<glad\glad.h> #include<GLFW\glfw3.h> static void whatIsGoingOnSeriouslyGuysHelp(int id,const char* desc) { std::cout<<desc; } int main() { glfwSetErrorCallback(&whatIsGoingOnSeriouslyGuysHelp); glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); GLFWwindow* window = glfwCreateWindow(100,100,"TEST",NULL,NULL); if (window == NULL) { std::cout<<"Window Creation Error"; } glfwMakeContextCurrent(window); gladLoadGL(); //glViewport(0,0,100,100); while (!glfwWindowShouldClose(window)) { //std::cout<<"?"; glfwPollEvents(); glfwSwapBuffers(window); //glClearColor(0.2f, 0.3f, 0.3f, 1.0f); //glClear(GL_COLOR_BUFFER_BIT); } glfwDestroyWindow(window); glfwTerminate(); return 0; }
I have tried re-installing GLAD, but that didn't do anything. I haven't tried re-installing GLFW, but I don't think that's the problem.
Correct any misconceptions I have or errors I am making.