0

Hi i'm trying to make a game using C and Open GL and when I try to get the monitor size it's giving me these errors:

/usr/bin/ld: /tmp/cczIyBBN.o: in function `GetMaxMonitorResolution':
main.c:(.text+0x15): undefined reference to `glfwGetPrimaryMonitor'
/usr/bin/ld: main.c:(.text+0x25): undefined reference to `glfwGetVideoMode'
collect2: error: ld returned 1 exit status

I use glfw3.h header in my c func.

Here's my code:

#include "res.h"
#include "GL/glut.h"
#include "../glfw/glfw3.h"
#include "../glfw/glfw3native.h"

void GetMaxMonitorResolution(int* w, int* h)
{
    int count;
    int monitor;
    const GLFWvidmode* modes = glfwGetVideoMode(glfwGetPrimaryMonitor());

    int maxWidth = 0;
    int maxHeight = 0;
    for (int i = 0; i < count; i++)
    {
        if (modes[i].width > maxWidth)
            maxWidth = modes[i].width;
        if (modes[i].height > maxHeight)
            maxHeight = modes[i].height;
    }

    *w = maxWidth;
    *h = maxHeight;

    if(isFullscreen == false)
    {
        height = height;
        width = width;

        xWindow = 100;
        yWindow = 100;
    }
    if(isFullscreen == true)
    {
        height = maxHeight;
        width = maxWidth;

        xWindow = 0;
        yWindow = 0;
    }
    else
    {
        height = 0;
        width = 0;

        xWindow = 0;
        yWindow = 0;
    }
}

Thanks for helping! :)

0 Answers0