# The GLFW LIbrary Is Not Initialized

**URL:** <https://discourse.glfw.org/t/the-glfw-library-is-not-initialized/120>\
**Category:** support\
**Created:** [February 18, 2015, 4:46pm UTC](https://discourse.glfw.org/t/the-glfw-library-is-not-initialized/120 "2015-02-18T16:46:09Z")\
**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:** [February 18, 2015, 4:46pm UTC](https://discourse.glfw.org/t/the-glfw-library-is-not-initialized/120/1 "2015-02-18T16:46:09Z")

</div>

**[scooperly](https://sourceforge.net/u/scooperly/)** wrote on [Wednesday, February 18, 2015](https://sourceforge.net/p/glfw/discussion/247562/thread/95ae0d7a/#4c49):

I have supposedly initialized GLFW at the begging of my Main call, but when I try to do an OpenGL call from a separate class that I have passed the GFLWwindow context to it gives me “the glfw library is not initialized” error on every draw loop, even though at the beginning of each function I check for !glfwInit()

Details:  
Using GLFW 3.0.4  
64-bit C++ Application  
Only using fixed function OpenGL calls

---

<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:** [March 14, 2015, 11:43am UTC](https://discourse.glfw.org/t/the-glfw-library-is-not-initialized/120/2 "2015-03-14T11:43:19Z")

</div>

**[bastiaanolij](https://sourceforge.net/u/bastiaanolij/)** wrote on [Saturday, March 14, 2015](https://sourceforge.net/p/glfw/discussion/247562/thread/95ae0d7a/#e82b):

I’m not sure if you are supposed to call glfwInit multiple times?

---

<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:** [March 17, 2015, 2:56am UTC](https://discourse.glfw.org/t/the-glfw-library-is-not-initialized/120/3 "2015-03-17T02:56:53Z")

</div>

**[arampl](https://sourceforge.net/u/arampl/)** wrote on [Tuesday, March 17, 2015](https://sourceforge.net/p/glfw/discussion/247562/thread/95ae0d7a/#7fc2):

Look here. My be your problem is this:

[https://www.opengl.org/wiki/Common\_Mistakes](https://www.opengl.org/wiki/Common_Mistakes) (#2)

Excerpt:

“…Do not use constructors/destructors to initialize/destroy OpenGL objects. Instead, use member functions of these classes for these purposes. This violates RAII principles, so this is not the best course of action.  
Have your OpenGL object constructors throw an exception if a context has not been created yet. This requires an addition to your context creation functionality that tells your code when a context has been created and is active.  
Create a class that owns all other OpenGL related objects. This class should also be responsible for creating the context in its constructor…”
