代码之家  ›  专栏  ›  技术社区  ›  Hortitude

雪豹上的dylib“文件不是必需的架构”

  •  0
  • Hortitude  · 技术社区  · 16 年前

    我已经在SnowLeopard上编译了opencv,它说它编译正确,但是当我试图编译我的示例程序时,我得到的输出如下:

    g++ -o tm_scons template.o -L/opencv/opencv/build/lib -lcxcore -lcv -lcvaux -lhighgui -lml
    ld: warning: in /opencv/opencv/build/lib/libcxcore.dylib, file is not of required architecture
    ld: warning: in /opencv/opencv/build/lib/libcv.dylib, file is not of required architecture
    ld: warning: in /opencv/opencv/build/lib/libcvaux.dylib, file is not of required architecture
    ld: warning: in /opencv/opencv/build/lib/libhighgui.dylib, file is not of required architecture
    ld: warning: in /opencv/opencv/build/lib/libml.dylib, file is not of required architecture
    

    这可能是我编译OpenCV或使用它的应用程序的问题吗?

    3 回复  |  直到 9 年前
        1
  •  0
  •   Chuck    16 年前

    正确地编译并不意味着要为您现在试图编译的任何体系结构进行编译。很可能库被编译为32位,而您编译为64位,反之亦然。

        2
  •  0
  •   Stephen Canon    16 年前

    很可能您的程序是64位编译的(雪豹的默认行为),而库是32位编译的。尝试添加 -m32 -arch i386 当您构建程序并查看链接是否工作时,标记到编译器。

        3
  •  0
  •   Hortitude    16 年前

    事实证明,魔法是使用-m32并切换到/usr/bin/g++-4.0编译器。

    呃…