I'm new to C++ and i'm try to learn to create my window so i watched a YouTube tutorial. And i followed what he did and i'm getting this errors.
here's my code.
#include "include/GLFW/glfw3.h"#include "deps/linmath.h"#include <stdlib.h>#include <stdio.h>int main(){if (!glfwInit()) { exit(EXIT_FAILURE);}glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);GLFWwindow* window = glfwCreateWindow(640, 480, "OPENGL EXAMPLE", NULL, NULL);if(!window) { glfwTerminate(); exit(EXIT_FAILURE);}glfwSwapInterval(1);while(!glfwWindowShouldClose(window)) { //Setup View float ratio; int width, height; glfwGetFramebufferSize(window, &width, &height); ratio = width / (float)height; glViewport(0, 0, width, height); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); glfwPollEvents();}glfwDestroyWindow(window);glfwTerminate;exit(EXIT_SUCCESS);}
and this is the error
/usr/bin/ld: /tmp/ccKjVhJ2.o: in function `main':main.cpp:(.text+0x1c): undefined reference to `glfwInit'/usr/bin/ld: main.cpp:(.text+0x3e): undefined reference to `glfwWindowHint'/usr/bin/ld: main.cpp:(.text+0x4d): undefined reference to `glfwWindowHint'/usr/bin/ld: main.cpp:(.text+0x71): undefined reference to `glfwCreateWindow'/usr/bin/ld: main.cpp:(.text+0x81): undefined reference to `glfwTerminate'/usr/bin/ld: main.cpp:(.text+0x95): undefined reference to `glfwSwapInterval'/usr/bin/ld: main.cpp:(.text+0xae): undefined reference to `glfwGetFramebufferSize'/usr/bin/ld: main.cpp:(.text+0xe6): undefined reference to `glViewport'/usr/bin/ld: main.cpp:(.text+0xf0): undefined reference to `glClear'/usr/bin/ld: main.cpp:(.text+0xfc): undefined reference to `glfwSwapBuffers'/usr/bin/ld: main.cpp:(.text+0x101): undefined reference to `glfwPollEvents'/usr/bin/ld: main.cpp:(.text+0x10d): undefined reference to `glfwWindowShouldClose'/usr/bin/ld: main.cpp:(.text+0x122): undefined reference to `glfwDestroyWindow'collect2: error: ld returned 1 exit status
I don't understand why it's saying "Undefined Reference to 'glfwInit'"