I’m trying to compile this demo file that I found online without GLAD (just as a test). I’m using GCC on Ubuntu 20.04 and have tried these compiler options:
-lglfw3
-lglfw
-lopengl32
At first I tried to compile GLFW from scratch but couldn’t so tried installing libglfw3-dev
Right now I’m still using FreeGLUT but I prefer GLFW. Here is the code
#include <GLFW/glfw3.h>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
-lglut worked, kinda. It compiled without saying it doesn’t exist but gives the error “glClear not found”. Thanks!