【问题标题】:Linking glib in XCode在 XCode 中链接 glib
【发布时间】:2013-03-02 12:57:05
【问题描述】:

我有一个奇怪的问题,这可能很明显,但目前对我来说真的不清楚:

我正在制作一个 Quartz Composer 插件。 我有一个基于 XCode 的工作区,其中包括一个自定义库。该库正在编译 poly2tri-c delaunay 三角剖分库,该库链接 glib。 我编译我的库没有问题,但插件本身不想编译并抛出这些错误:

架构 i386 的未定义符号: “p2t_cdt_new(_GPtrArray*)”,引用自: -[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] 在 libhOzVector.a(hOzPolygons.o) “p2t_cdt_free(CDT_)”,引用自: -[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] 在 libhOzVector.a(hOzPolygons.o) “p2t_point_new_dd(double, double)”,引用自: -[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] 在 libhOzVector.a(hOzPolygons.o) “p2t_cdt_triangulate(CDT_)”,引用自: -[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] 在 libhOzVector.a(hOzPolygons.o) “p2t_cdt_get_triangles(CDT_)”,引用自: -[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] 在 libhOzVector.a(hOzPolygons.o) “p2t_triangle_get_point(_P2tTriangle, int)”,引用自: -[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] 在 libhOzVector.a(hOzPolygons.o) “_g_ptr_array_add”,引用自: -[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] 在 libhOzVector.a(hOzPolygons.o) “_g_ptr_array_new”,引用自: -[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] 在 libhOzVector.a(hOzPolygons.o) ld:未找到体系结构 i386 的符号 collect2: ld 返回 1 个退出状态

这是编译器消息的图片:

还有我的链接:

当我忘记链接库时,我通常会收到这些消息,但这里我链接的是库本身和插件项目中的 glib。

关于什么是错的任何想法?

谢谢!

【问题讨论】:

    标签: xcode linker shared-libraries glib quartz-composer


    【解决方案1】:

    好吧,经过一些“深奥”的研究,我终于发现了问题所在:XCode 只是没有自动将 c 文件包含在目标成员中...

    【讨论】:

    • 您能详细说明一下吗?我有一个类似的问题。我在 XCode 的 Other C Flags 部分中包含 -I 参数,如果我创建例如 GList 指针,我没有问题,但如果我调用任何 GLib 函数,例如 g_list_append(),编译器会抛出错误
    • 我不知道你到底发生了什么。但是,对我来说,只是我所有的项目文件都没有 .mm 扩展名;而且,GLib 源文件没有自动添加到 Target Membership(右侧 XCode 面板)中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多