我正在尝试用 ldc 用 D 语言编译一个简单的程序,但它似乎无法与 openGL 链接。
铿锵声工作正常:
clang `pkg-config --cflags --libs glu gl libglfw` triangle.c
最不发达国家信息
LDC - the LLVM D compiler (trunk):
based on DMD v2.060 and LLVM 3.2svn
Default target: x86_64-apple-darwin12.2.1
和 pkg-config 的结果
pkg-config --cflags --libs glu gl libglfw
-I/usr/local/include -I/opt/X11/include -L/usr/local/lib -L/opt/X11/lib -framework Cocoa -framework OpenGL -framework IOKit -lGLU -lGL -lglfw
命令行
$ ldc2 -L-lglfw -L-L/opt/X11/lib -L-lGL -L-lGLU -w triangle.d
Undefined symbols for architecture x86_64:
"__D2gl10glVertex3fFfffZv", referenced from:
__Dmain in triangle.o
"__D2gl10glViewportFiiiiZv", referenced from:
__Dmain in triangle.o
"__D2gl12glClearColorFffffZv", referenced from:
__Dmain in triangle.o
"__D2gl12glMatrixModeFkZv", referenced from:
__Dmain in triangle.o
"__D2gl12glTranslatefFfffZv", referenced from:
__Dmain in triangle.o
"__D2gl14glLoadIdentityFZv", referenced from:
__Dmain in triangle.o
"__D2gl5glEndFZv", referenced from:
__Dmain in triangle.o
"__D2gl7glBeginFkZv", referenced from:
__Dmain in triangle.o
"__D2gl7glClearFkZv", referenced from:
__Dmain in triangle.o
"__D2gl9glColor3fFfffZv", referenced from:
__Dmain in triangle.o
"__D2gl9glRotatefFffffZv", referenced from:
__Dmain in triangle.o
"__D3glu14gluPerspectiveFddddZv", referenced from:
__Dmain in triangle.o
"__D3glu9gluLookAtFdddddddddZv", referenced from:
__Dmain in triangle.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Error: /usr/bin/gcc failed with status: 1