digitalmars.D - Building a GLFW app w/ GDC on a Mac
- Max kaufmann (28/28) Oct 20 2007 Trying to build this app on a mac:
- Johan Granberg (4/12) Oct 21 2007 Is glClear in ~/src/dlib/gl.d defined as extern(C)? If not that's probab...
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (6/11) Oct 21 2007 Seems that you are missing the OpenGL bindings ?
- Max Kaufmann (12/48) Oct 21 2007 Figured it out. Just needed to replace:
Trying to build this app on a mac:
import glfw;
void main() {
int running = 1;
glfwInit();
if (!glfwOpenWindow(300,300,0,0,0,0,16,0,GLFW_WINDOW)) {
glfwTerminate();
return 0;
}
glfwSetWindowTitle("GLFW - now in D!");
glfwSwapInterval(0);
while( running ) {
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers();
if (!glfwGetWindowParam(GLFW_OPENED)) {
running = 0;
}
}
glfwTerminate();
}
I compiled using this command:
~/gdc/bin/gdc -I ~/src/dlib/ ~/src/dlib/*.d hello.d -lglfw -framework Carbon
-framework AGL -framework OpenGL -o app
Initially ~/src/dlib/glfw.d was giving me compile errors because of two "const"
parameters in line 344 and 347, so I just nixed those type specifiers, and it
compiled fine, however now I'm getting the link error:
/usr/bin/ld: Undefined symbols:
__D2gl7glClearFkZv
collect2: ld returned 1 exit status
When I comment out the call to glClear() the app links fine and when I execute
it I get the window I'd expect, but filled with garbage because there's
nothing's clearing the buffers.
Has anyone else run into this problem? I've read about people compiling glfw
w/ gdc on a mac fine before, what am I doing wrong?
Oct 20 2007
Max kaufmann wrote:Trying to build this app on a mac:...Initially ~/src/dlib/glfw.d was giving me compile errors because of two "const" parameters in line 344 and 347, so I just nixed those type specifiers, and it compiled fine, however now I'm getting the link error: /usr/bin/ld: Undefined symbols: __D2gl7glClearFkZv collect2: ld returned 1 exit statusIs glClear in ~/src/dlib/gl.d defined as extern(C)? If not that's probably the problem.
Oct 21 2007
Max kaufmann wrote:Initially ~/src/dlib/glfw.d was giving me compile errors because of two "const" parameters in line 344 and 347, so I just nixed those type specifiers, and it compiled fine, however now I'm getting the link error: /usr/bin/ld: Undefined symbols: __D2gl7glClearFkZv collect2: ld returned 1 exit statusSeems that you are missing the OpenGL bindings ? You can find OpenGL and GLFW on my home page, along with the little "boing.d" sample program. http://www.algonet.se/~afb/d/ - import gl.glfw; --anders
Oct 21 2007
Figured it out. Just needed to replace:
version(Win32)
extern(Windows):
version(linux)
extern(C):
with
version(Win32)
extern(Windows):
else
extern(C):
I'll send a note about it to the GLFW dev guys to about the mod.
Max kaufmann Wrote:
Trying to build this app on a mac:
import glfw;
void main() {
int running = 1;
glfwInit();
if (!glfwOpenWindow(300,300,0,0,0,0,16,0,GLFW_WINDOW)) {
glfwTerminate();
return 0;
}
glfwSetWindowTitle("GLFW - now in D!");
glfwSwapInterval(0);
while( running ) {
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers();
if (!glfwGetWindowParam(GLFW_OPENED)) {
running = 0;
}
}
glfwTerminate();
}
I compiled using this command:
~/gdc/bin/gdc -I ~/src/dlib/ ~/src/dlib/*.d hello.d -lglfw -framework Carbon
-framework AGL -framework OpenGL -o app
Initially ~/src/dlib/glfw.d was giving me compile errors because of two
"const" parameters in line 344 and 347, so I just nixed those type specifiers,
and it compiled fine, however now I'm getting the link error:
/usr/bin/ld: Undefined symbols:
__D2gl7glClearFkZv
collect2: ld returned 1 exit status
When I comment out the call to glClear() the app links fine and when I execute
it I get the window I'd expect, but filled with garbage because there's
nothing's clearing the buffers.
Has anyone else run into this problem? I've read about people compiling glfw
w/ gdc on a mac fine before, what am I doing wrong?
Oct 21 2007









Johan Granberg <lijat.meREM OVEgmail.com> 