我最近从 openSuse 切换到 Ubuntu,在编译我的一个项目时遇到了麻烦(https://github.com/laleksic/URMulator) 可以在 openSuse 上完美运行。
运行 make,我得到以下信息:
laleksic@Lenovo-G560:~/Fakultet/URMulator$ make
gcc -g -w -std=c99 \
`pkg-config --cflags --libs glib-2.0 libgvc gtk+-2.0 gtksourceview-2.0 goocanvas` \
-IHeaders \
-o Executable/urm \
Sources/Main.c Sources/Register.c Sources/Instruction.c Sources/URM.c Sources/Graph.c Sources/GUI.c
Package goocanvas was not found in the pkg-config search path.
Perhaps you should add the directory containing `goocanvas.pc' to the PKG_CONFIG_PATH environment variable
No package 'goocanvas' found
In file included from Sources/Main.c:10:0:
Headers/Main.h:24:22: fatal error: glib.h: No such file or directory
compilation terminated.
In file included from Sources/Register.c:10:0:
Headers/Main.h:24:22: fatal error: glib.h: No such file or directory
compilation terminated.
In file included from Sources/Instruction.c:10:0:
Headers/Main.h:24:22: fatal error: glib.h: No such file or directory
compilation terminated.
In file included from Sources/URM.c:10:0:
Headers/Main.h:24:22: fatal error: glib.h: No such file or directory
compilation terminated.
In file included from Sources/Graph.c:10:0:
Headers/Main.h:24:22: fatal error: glib.h: No such file or directory
compilation terminated.
In file included from Sources/GUI.c:10:0:
Headers/Main.h:24:22: fatal error: glib.h: No such file or directory
compilation terminated.
Makefile:22: recipe for target 'Urmulator' failed
make: *** [Urmulator] Error 1
我已经安装了 libglib2.0-dev,并且 glib-2.0.pc 位于正确的位置,因此我不明白问题出在哪里,如果能得到任何帮助,我将不胜感激。谢谢。
编辑:按照 fkraiem 的建议,现在出现了新的错误。我安装了 libgoocanvas-2.0 而不是 libgoocanvas。这修复了有关 goocanvas 的部分,尽管我仍然有很多错误。列表太长了,无法发布,但归根结底是因为编译器无法识别任何 gtk、glib 或 goocanvas 函数……
gcc -g -w -std=c99 \
`pkg-config --cflags --libs glib-2.0 libgvc gtk+-2.0 gtksourceview-2.0 goocanvas` \
-IHeaders \
-o Executable/urm \
Sources/Main.c Sources/Register.c Sources/Instruction.c Sources/URM.c Sources/Graph.c Sources/GUI.c
/tmp/ccG4zuCY.o: In function `RegisterListCreate':
/home/laleksic/Fakultet/URMulator/Sources/Register.c:15: undefined reference to `g_list_append'
/tmp/ccG4zuCY.o: In function `RegisterListDestroy':
/home/laleksic/Fakultet/URMulator/Sources/Register.c:65: undefined reference to `g_list_free'
/tmp/ccG4zuCY.o: In function `RegisterCreateAndAppend':
/home/laleksic/Fakultet/URMulator/Sources/Register.c:80: undefined reference to `g_type_check_instance_cast'
...
/home/laleksic/Fakultet/URMulator/Sources/GUI.c:353: undefined reference to `gtk_box_pack_end'
/home/laleksic/Fakultet/URMulator/Sources/GUI.c:355: undefined reference to `gtk_widget_show'
/home/laleksic/Fakultet/URMulator/Sources/GUI.c:356: undefined reference to `gtk_widget_show'
/home/laleksic/Fakultet/URMulator/Sources/GUI.c:357: undefined reference to `gtk_widget_show'
/home/laleksic/Fakultet/URMulator/Sources/GUI.c:359: undefined reference to `gtk_widget_show'
/home/laleksic/Fakultet/URMulator/Sources/GUI.c:360: undefined reference to `gtk_widget_show'
/home/laleksic/Fakultet/URMulator/Sources/GUI.c:366: undefined reference to `gtk_main'
collect2: error: ld returned 1 exit status
Makefile:22: recipe for target 'Urmulator' failed
make: *** [Urmulator] Error 1