# GLFW initialized, yet not?

**URL:** <https://discourse.glfw.org/t/glfw-initialized-yet-not/586>\
**Category:** support\
**Created:** [June 27, 2013, 11:49am UTC](https://discourse.glfw.org/t/glfw-initialized-yet-not/586 "2013-06-27T11:49:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [June 27, 2013, 11:49am UTC](https://discourse.glfw.org/t/glfw-initialized-yet-not/586/1 "2013-06-27T11:49:13Z")

</div>

**[mskull](https://sourceforge.net/u/mskull/)** wrote on [Thursday, June 27, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/c9ed5fa8/#d3df):

I’m having this weird issue where the glfwCreateWindow function fails, complaining about how I havn’t initialized GLFW, even though the glfwInit function returns successful just before?

I’m guessing the reason for this might be because I havn’t setup GLFW completely correctly, but if so I’m gonna need some help getting that fixed, as I’m not to experienced in setting up external libraries, especially in Code::Blocks.

Here’s is an outtake from my Base class’s Init function, which is where I’m getting the error

```auto
bool Base::Init()
{
    glfwSetErrorCallback( error_callback );
    
    if( !glfwInit() ) // <-- this function returns true, yet sends an error to the error_callback function
    {
        cout << "Failed to initialize GLFW!" << endl;
        return false;
    }
    
    // Here is my main issue. GLFW sends the same error to the call_back function again
    window = glfwCreateWindow( 800, 600, "GLFW Window", glfwGetPrimaryMonitor(), NULL )
    
    if( !window )
    {
        cout << "Failed to create window!" << endl;
        return false;
    }
    
    glfwMakeContextCurrent( window );
    
    ...
    
    return true;
}

```

Here’s the error messages from the console

> 65537 The GLFW library is not initialized  
> 65537 The GLFW library is not initialized  
> Failed to create window!

Thanks in advance for any help you can give me

mSkull

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [June 27, 2013, 12:40pm UTC](https://discourse.glfw.org/t/glfw-initialized-yet-not/586/2 "2013-06-27T12:40:14Z")

</div>

**[cameronking](https://sourceforge.net/u/cameronking/)** wrote on [Thursday, June 27, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/c9ed5fa8/#3cdb):

Have you tried placing the glfwSetErrorCallback( error\_callback ); after the glfwInit();?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [June 27, 2013, 12:44pm UTC](https://discourse.glfw.org/t/glfw-initialized-yet-not/586/3 "2013-06-27T12:44:39Z")

</div>

**[mskull](https://sourceforge.net/u/mskull/)** wrote on [Thursday, June 27, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/c9ed5fa8/#b51c):

According to the documentation the glfwSetErrorCallback is one of the functions that may be called before glfwInit. Initially I didn’t have that function at all, and added it after the window failed to create.

I can try to do what you say, but I doubt it’ll change anything

edit:  
I tried changing the order, but got the same result  
Interesting enough, I still got 2 of the 65537 error - I thought one of them came from glfwInit, but apparently not

In any case, thanks fro your reply
