Hi I'm getting a Segmentation Fault with the example in the GLFW 2.7 Users
Guide in section 2.4 titled a "Minimal GLFW Application". I'm Mac OSX 10.6
with Xcode 3.2.5 installed.
I compiled GLFW 2.7 with "make cocoa-install" and then copied libglfw.dylib
over to /usr/local/lib
I run with: ./test
and the code seg faults and only print out my "print 1" line.
Any ideas on what I'm doing wrong? I'm suspicious of the GL libraries or
something….
#include<GL/glfw.h>#include<stdlib.h>#include<iostream>usingstd::cout;intmain(void){intrunning=GL_TRUE;// Initialize GLFWif(!glfwInit())exit(EXIT_FAILURE);// Open an OpenGL windowif(!glfwOpenWindow(300,300,0,0,0,0,0,0,GLFW_WINDOW)){glfwTerminate();exit(EXIT_FAILURE);}// Main loopwhile(running){[b]cout<<"print 1\n";[/b]// OpenGL rendering goes here...glClear(GL_COLOR_BUFFER_BIT);cout<<"print 2\n";// Swap front and back rendering buffersglfwSwapBuffers();// Check if ESC key was pressed or window was closedrunning=!glfwGetKey(GLFW_KEY_ESC)&&glfwGetWindowParam(GLFW_OPENED);}// Close window and terminate GLFWglfwTerminate();// Exit programexit(EXIT_SUCCESS);}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The problem is that you are linking against the X11 libraries while using the
Cocoa port of GLFW. Information on the correct use of GLFW on Mac OS X is in
section 4.2.5 of readme.html, also available here: http://www.glfw.org/release-2.7.html
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi I'm getting a Segmentation Fault with the example in the GLFW 2.7 Users
Guide in section 2.4 titled a "Minimal GLFW Application". I'm Mac OSX 10.6
with Xcode 3.2.5 installed.
I compiled GLFW 2.7 with "make cocoa-install" and then copied libglfw.dylib
over to /usr/local/lib
I'm building with:
I run with: ./test
and the code seg faults and only print out my "print 1" line.
Any ideas on what I'm doing wrong? I'm suspicious of the GL libraries or
something….
Thank you for an exemplary bug report. I'll verify this asap.
The problem is that you are linking against the X11 libraries while using the
Cocoa port of GLFW. Information on the correct use of GLFW on Mac OS X is in
section 4.2.5 of readme.html, also available here:
http://www.glfw.org/release-2.7.html
Thanks elmindreda!
I changed build line to include "-framework Cocoa -framework OpenGL" and
dropped the additional GL library as the documentation said.
My corrected build line is now: