# Basic test flickers on OS X Yosemite \[solved\]

**URL:** <https://discourse.glfw.org/t/basic-test-flickers-on-os-x-yosemite-solved/771>\
**Category:** support\
**Created:** [September 23, 2016, 4:29am UTC](https://discourse.glfw.org/t/basic-test-flickers-on-os-x-yosemite-solved/771 "2016-09-23T04:29:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![colanderman](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@colanderman](https://discourse.glfw.org/u/colanderman)\
**Post date:** [September 23, 2016, 4:29am UTC](https://discourse.glfw.org/t/basic-test-flickers-on-os-x-yosemite-solved/771/1 "2016-09-23T04:29:23Z")

</div>

Hi, both a basic test I made myself following the example on the web site, and a pared-down version of simple.c (taking out all the rendering code except glClear) results in a flickering image. It seems that the 2nd buffer doesn’t get cleared. What could I be doing wrong? Here is the code I’m using:

```
#include <GLFW/glfw3.h>

int main()
{
  glfwInit();

  glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE);
  GLFWwindow *const window =
    glfwCreateWindow(640, 480, "test", NULL, NULL);

  glfwMakeContextCurrent(window);
  glfwSwapInterval(1);

  while (!glfwWindowShouldClose(window))
  {
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    glfwSwapBuffers(window);
    glfwPollEvents();
  }

  glfwDestroyWindow(window);
  glfwTerminate();
  return 0;
}

```

This is GLFW 3.2.1 installed via MacPorts on OS X v10.10.5, building using clang 7.0.2. Graphics card is an Nvidia GeForce GT 750M.

---

<div class="post-metadata">

**Author:** ![colanderman](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@colanderman](https://discourse.glfw.org/u/colanderman)\
**Post date:** [September 23, 2016, 5:28am UTC](https://discourse.glfw.org/t/basic-test-flickers-on-os-x-yosemite-solved/771/2 "2016-09-23T05:28:39Z")

</div>

Ah sorry nevermind this was my own issue. I was building with `-lgl` rather than with the frameworks pkg-config gave me.

However pkg-config seems to be missing `-framework OpenGL`:

```
$ pkg-config --static --libs glfw3
-L/opt/local/lib -lglfw -framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo

```

Not sure if this is a bug or by design. Regardless manually adding `-framework OpenGL` gets me a working test, yay!

---

<div class="post-metadata">

**Author:** ![elmindreda](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/elmindreda/32/26_2.png) [@elmindreda](https://discourse.glfw.org/u/elmindreda)\
**Post date:** [September 23, 2016, 10:54am UTC](https://discourse.glfw.org/t/basic-test-flickers-on-os-x-yosemite-solved/771/3 "2016-09-23T10:54:12Z")

</div>

> [@colanderman](#):
>
> Not sure if this is a bug or by design.

It’s by design. Since GLFW nowadays supports more APIs than OpenGL and doesn’t know which you will use, it loads things like `OpenGL.framework` and `vulkan-1.dll` as needed at runtime instead.

---

<div class="post-metadata">

**Author:** ![colanderman](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@colanderman](https://discourse.glfw.org/u/colanderman)\
**Post date:** [September 28, 2016, 10:47pm UTC](https://discourse.glfw.org/t/basic-test-flickers-on-os-x-yosemite-solved/771/4 "2016-09-28T22:47:29Z")

</div>

That makes sense, but if I build without `-framework OpenGL`, I get a screen full of linker errors. e.g.:

```
$ cc -Wall -Werror -march=corei7 $(pkg-config --static --libs glfw3) -o test *.o
Undefined symbols for architecture x86_64:
  "_glActiveTexture", referenced from:
      _graphics_init in graphics.o
      _graphics_draw in graphics.o
  "_glAttachShader", referenced from:
      _graphics_init in graphics.o

```

…etc. (–static or not doesn’t matter.) What am I missing?

---

<div class="post-metadata">

**Author:** ![elmindreda](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/elmindreda/32/26_2.png) [@elmindreda](https://discourse.glfw.org/u/elmindreda)\
**Post date:** [September 28, 2016, 11:02pm UTC](https://discourse.glfw.org/t/basic-test-flickers-on-os-x-yosemite-solved/771/5 "2016-09-28T23:02:12Z")

</div>

If you are calling OpenGL without using an [extension loader library](http://www.glfw.org/docs/latest/context_guide.html#context_glext_auto) then your application needs `-framework OpenGL`. Either method is perfectly fine. It’s just that GLFW itself doesn’t need either. The output of those pkg-config commands only gives you the dependencies of GLFW, and there’s no need to have `-framework OpenGL` there if you’re going to use ANGLE or MoltenVK or something else.

This is explained somewhat in the [pkg-config section](http://www.glfw.org/docs/latest/build_guide.html#build_link_pkgconfig) of the build guide, but I see there’s no example for macOS. I will update it.
