我真的很陌生,也是我使用的庫或框架(Gtk,Gdk和OpenCL)來創建應顯示mandelbrot集作爲動態圖片。架構x86_64的未定義符號:「_g_object_unref」
我已經根據我的教授提供的makefile創建了這個make文件。我與他的makefile遇到的問題是由於這樣的事實,我的教授正在使用其他操作系統,等
所以,我改變了自己的makefile來這是我的新的Makefile:
GTK_PACKAGES=gdk-pixbuf-2.0 gtk+-2.0
GTK_CFLAGS=$(shell pkg-config --cflags $(GTK_PACKAGES))
GTK_LIBS=$(shell pkg-config --libs $(GTK_PACKAGES))
CFLAGS=-g -Wall -O2 -std=c99 $(GTK_CFLAGS)
LIBS=$(GTK_LIBS)
PROGS=opencl_mandelbrot
.PHONY: all
all: $(PROGS)
%: %.c
$(CC) $(CFLAGS) $(LDFLAGS) $*.c -framework OpenCL -o [email protected]
%.o: %.c
$(CC) $(CFLAGS) -c $*.c -o [email protected]
opencl_mandelbrot: opencl_mandelbrot.o opencl_util.o
$(CC) $(CFLAGS) $(LDFLAGS) opencl_mandelbrot.o opencl_util.o -framework OpenCL -o [email protected]
.PHONY: clean
clean:
rm -f *.o $(PROGS)
但當我嘗試在終端上鍵入make
,我有以下錯誤:
cc -g -Wall -O2 -std=c99 -D_REENTRANT -I/opt/X11/include/cairo -I/opt/X11/include/pixman-1 -I/opt/X11/include -I/opt/X11/include/freetype2 -I/opt/X11/include/libpng15 -I/opt/X11/include -I/usr/local/Cellar/gdk-pixbuf/2.32.3/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/gtk+/2.24.30/include/gtk-2.0 -I/usr/local/Cellar/gtk+/2.24.30/lib/gtk-2.0/include -I/usr/local/Cellar/pango/1.38.1/include/pango-1.0 -I/usr/local/Cellar/harfbuzz/1.2.6/include/harfbuzz -I/usr/local/Cellar/pango/1.38.1/include/pango-1.0 -I/usr/local/Cellar/atk/2.18.0_1/include/atk-1.0 -I/usr/local/Cellar/libpng/1.6.21/include/libpng16 -I/usr/local/Cellar/glib/2.46.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.46.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -c opencl_mandelbrot.c -o opencl_mandelbrot.o
cc -g -Wall -O2 -std=c99 -D_REENTRANT -I/opt/X11/include/cairo -I/opt/X11/include/pixman-1 -I/opt/X11/include -I/opt/X11/include/freetype2 -I/opt/X11/include/libpng15 -I/opt/X11/include -I/usr/local/Cellar/gdk-pixbuf/2.32.3/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/gtk+/2.24.30/include/gtk-2.0 -I/usr/local/Cellar/gtk+/2.24.30/lib/gtk-2.0/include -I/usr/local/Cellar/pango/1.38.1/include/pango-1.0 -I/usr/local/Cellar/harfbuzz/1.2.6/include/harfbuzz -I/usr/local/Cellar/pango/1.38.1/include/pango-1.0 -I/usr/local/Cellar/atk/2.18.0_1/include/atk-1.0 -I/usr/local/Cellar/libpng/1.6.21/include/libpng16 -I/usr/local/Cellar/glib/2.46.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.46.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include opencl_mandelbrot.o opencl_util.o -framework OpenCL -o opencl_mandelbrot
Undefined symbols for architecture x86_64:
"_g_object_unref", referenced from:
_reallocate_pixbufs in opencl_mandelbrot.o
"_g_type_check_instance_cast", referenced from:
_main in opencl_mandelbrot.o
"_gdk_draw_pixbuf", referenced from:
_draw_mandelbrot_full_with_gpu in opencl_mandelbrot.o
"_gdk_pixbuf_get_height", referenced from:
_reallocate_pixbufs in opencl_mandelbrot.o
_recenter in opencl_mandelbrot.o
_draw_mandelbrot_full_with_gpu in opencl_mandelbrot.o
"_gdk_pixbuf_get_n_channels", referenced from:
_draw_mandelbrot_full_with_gpu in opencl_mandelbrot.o
"_gdk_pixbuf_get_pixels", referenced from:
_draw_mandelbrot_full_with_gpu in opencl_mandelbrot.o
"_gdk_pixbuf_get_rowstride", referenced from:
_reallocate_pixbufs in opencl_mandelbrot.o
_draw_mandelbrot_full_with_gpu in opencl_mandelbrot.o
"_gdk_pixbuf_get_width", referenced from:
_reallocate_pixbufs in opencl_mandelbrot.o
_recenter in opencl_mandelbrot.o
_draw_mandelbrot_full_with_gpu in opencl_mandelbrot.o
"_gdk_pixbuf_new", referenced from:
_reallocate_pixbufs in opencl_mandelbrot.o
"_gtk_init", referenced from:
_main in opencl_mandelbrot.o
"_gtk_main", referenced from:
_main in opencl_mandelbrot.o
"_gtk_main_quit", referenced from:
_destroy_window in opencl_mandelbrot.o
_keyboard_input in opencl_mandelbrot.o
"_gtk_object_get_type", referenced from:
_main in opencl_mandelbrot.o
"_gtk_signal_connect_full", referenced from:
_main in opencl_mandelbrot.o
"_gtk_widget_set_events", referenced from:
_main in opencl_mandelbrot.o
"_gtk_widget_show_all", referenced from:
_main in opencl_mandelbrot.o
"_gtk_window_get_type", referenced from:
_main in opencl_mandelbrot.o
"_gtk_window_new", referenced from:
_main in opencl_mandelbrot.o
"_gtk_window_resize", referenced from:
_main in opencl_mandelbrot.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [opencl_mandelbrot] Error 1
即使我使用
brew
安裝
gtk
,但我想這個問題是關係到聯動或類似的東西的順序。 ..
我感謝您的幫助!