使用glib库提供一个简单的C程序来引用和取消引用GObject。我在ubuntu上编写了代码,并在上面安装了glib库。
运行命令
gcc *.c `pkg-config --cflags --libs glib-2.0` -o test
工作正常。
现在我在MacO上尝试了相同的操作。我安装了gcc,glib并尝试了上述命令。但是我收到以下错误:
Undefined symbols for architecture x86_64:
"_g_obejct_new",referenced from:
_my_obejct_new in program-4735d1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
现在我已经尝试了不同的方法,例如像here
那样构建glib库。但仍然出现相同的错误。
还要注意的一点是,ubuntu也具有我通过运行命令uname-m