Quantcast
Channel: How to run and compile C++ GLFW code using Atom with the package gpp-compiler - Stack Overflow
Viewing all articles
Browse latest Browse all 2

How to run and compile C++ GLFW code using Atom with the package gpp-compiler

$
0
0

So I want to use Atom as my IDE in my journey in learning GLFW. This is my 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);        glBegin(GL_TRIANGLES);        glVertex2f(-0.5f, -0.5f);        glVertex2f(0.0f, 0.5f);        glVertex2f(0.5f, -0.5f);        glEnd();        /* Swap front and back buffers */        glfwSwapBuffers(window);        /* Poll for and process events */        glfwPollEvents();    }    glfwTerminate();    return 0;}

So i've already tried searching for questions similar to mine but to my luck the answers in those questions did not work. I already added the lib files of GLFW to MinGW lib folder and it did not work this is the error I'am getting. I know that I am getting this error because the gpp-compiler can't find the GLFW lib files.

Thank you answering :D

C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0x17): undefined reference to `glfwInit'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0x56): undefined reference to `glfwCreateWindow'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0x64): undefined reference to `glfwTerminate'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0x79): undefined reference to `glfwMakeContextCurrent'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0x84): undefined reference to `glfwWindowShouldClose'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0x9d): undefined reference to `_imp__glClear@4'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0xae): undefined reference to `_imp__glBegin@4'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0xcb): undefined reference to `_imp__glVertex2f@8'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0xe4): undefined reference to `_imp__glVertex2f@8'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0x101): undefined reference to `_imp__glVertex2f@8'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0x10b): undefined reference to `_imp__glEnd@0'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0x118): undefined reference to `glfwSwapBuffers'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0x11d): undefined reference to `glfwPollEvents'C:\Users\Asus\AppData\Local\Temp\cc4lMOFw.o:main.cpp:(.text+0x127): undefined reference to `glfwTerminate'collect2.exe: error: ld returned 1 exit status

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images