Static compile glfw

pixelblender3d wrote on Sunday, August 21, 2011:


inside my project directory i got “external/glfw” which contains glfw 2.7.1
source. i’ve compiled it by running “make x11-install” which put:

i also got this simple code in test.c:

#include <stdio.h>
#include <stdlib.h>
#include "external/glfw/include/GL/glfw.h"
int main( int argc, char const* argv[] )
    if( !glfwInit() ){
        fprintf( stderr, "Init Failed\n" );
    glfwOpenWindowHint( GLFW_FSAA_SAMPLES, 4 );
    glfwOpenWindowHint( GLFW_OPENGL_VERSION_MAJOR, 3 );
    glfwOpenWindowHint( GLFW_OPENGL_VERSION_MINOR, 1 );
    // Open a window and create its OpenGL context
    if( !glfwOpenWindow( 1024, 768, 0,0,0,0, 32,0, GLFW_WINDOW )){
        fprintf( stderr, "failed at glfwOpenWindow\n" );
        return -1;
    return 0;

i’m trying to compile glfw as static link and compiled the code using gcc with

/usr/bin/gcc `pkg-config --cflags libglfw` -o test test.c `pkg-config --libs libglfw` -lXrandr  -lX11 -lGLU -lGL -pthread -lm

and it doesn’t give me any error. but when i try to execute the binary it
shows that i’ve failed to call glfwOpenWindow. could any one help me please?

thank you for your time guys!



elmindreda wrote on Sunday, August 21, 2011:

Do you really mean that you failed to call glfwOpenWindow or do you mean that
the call to glfwOpenWindow failed?