0
votes

everytime i try to compile it to test it doesnt recongnise files

#include <GL\glew.h>
#include <GLFW/glfw3.h>

#ifdef _WIN32
#pragma comment(lib, "winmm.lib")
#endif // _WIN32

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);
    if(!glewInit())
      return -1;

    /* 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;
}
1
What do you mean by "it doesnt recongnise files"? Are you getting any errors?ForceBru
yes i put the needed include filess and it doesnt recongnise itHaicerikas
Look into your pre-compiled headers directory if there is such a file.sanitizedUser
what do you mean?Haicerikas
your question is poorly asked. You need to be more precise in what your askingmasonCherry

1 Answers

0
votes

When you are using a compiler you need to tell it the directory to find files that you include. In the line

#include <GL\glew.h>
#include <GLFW/glfw3.h>

This is telling the compiler to include the files glew.h and glfw3.h. The problem is how is the compiler supposed to know where those files are (it doesn't search your entire Drive for them. c++ compilers have a way for you to tell it where these files are relative to.

In gcc/g++ you use the -I flag and specify where this directory is.

specify the folders where you stored gl\glew.h and glfw\glfw3.hto the gcc using that -I option. If your files are store in C:\Users\John\Projects\dependencies\GLFW\include\glew\glew.h and C:\Users\John\Projects\dependencies\Glew\include\glfw\glfw3.h then use the the flags like so

gcc -IC:\Users\John\Projects\dependencies\GLFW\include
    -IC:\Users\John\Projects\dependencies\Glew\include main.c -o out_file