代码之家  ›  专栏  ›  技术社区  ›  Patrick Oscity

在Xcode项目中使用动态库(DevIL/OpenIL)

  •  1
  • Patrick Oscity  · 技术社区  · 15 年前

    我正在尝试编译使用OpenGL、SDL和ilakadevilakaoopenil库的示例源代码。OpenGL和SDL可以作为本机框架使用,但魔鬼不能。所以我做了以下几点:

    我通过自制安装了魔鬼。首先我改变了公式,因为我需要:

    brew edit devil
    

    然后编辑这些行

    def install
      system "./configure", "--disable-debug", "--disable-dependency-tracking",
                            "--prefix=#{prefix}", "--enable-ILU"
      system "make install"
    end
    

    像这样

    def install
      system "./configure", "--disable-debug", "--disable-dependency-tracking",
                            "--prefix=#{prefix}", "--enable-ILU", "--enable-ILUT"
      system "make install"
    end
    

    [sudo] brew install devil
    

    给了我魔鬼头球 /usr/local/include/ 以及 /usr/local/lib/

    • 右击我唯一的目标
    • 单击“添加现有框架”
    • 添加 libIL.dylib , libILU.dylib libILUT.dylib

    libIL.1.dylib , libILU.1.dylib libILUT.1.dylib 名单上有,这正常吗?)

    然后,我在“项目”>“编辑项目设置”>“生成”>“其他链接器标志”中添加了以下标志:

    -lil -lilu -lilut
    

    Ld "build/Debug/XCode OpenGL OOP Framework.app/Contents/MacOS/XCode OpenGL OOP Framework" normal i386
    cd "/Users/padde/Documents/Studium/sem5/computergrafik/opengl intro/xcode projects/XCode OpenGL OOP Framework"
    /Developer/usr/bin/g++-4.2 -arch i386 "-L/Users/padde/Documents/Studium/sem5/computergrafik/opengl intro/xcode projects/XCode OpenGL OOP Framework/build/Debug" "-F/Users/padde/Documents/Studium/sem5/computergrafik/opengl intro/xcode projects/XCode OpenGL OOP Framework/build/Debug" -filelist "/Users/padde/Documents/Studium/sem5/computergrafik/opengl intro/xcode projects/XCode OpenGL OOP Framework/build/XCode OpenGL OOP Framework.build/Debug/XCode OpenGL OOP Framework.build/Objects-normal/i386/XCode OpenGL OOP Framework.LinkFileList" -framework Foundation -framework AppKit -framework GLUT -framework OpenGL -framework SDL -lIL -lILU -lILUT -o "/Users/padde/Documents/Studium/sem5/computergrafik/opengl intro/xcode projects/XCode OpenGL OOP Framework/build/Debug/XCode OpenGL OOP Framework.app/Contents/MacOS/XCode OpenGL OOP Framework"
    
    ld: warning: in /usr/local/lib/libIL.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
    ld: warning: in /usr/local/lib/libILU.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
    ld: warning: in /usr/local/lib/libILUT.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
    Undefined symbols:
      "_ilInit", referenced from:
          RenderEngine::initManagers()       in RenderEngine.o
      "_ilGetData", referenced from:
          TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
      "_ilBindImage", referenced from:
          TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
      "_ilLoadImage", referenced from:
          TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
      "_ilGenImages", referenced from:
          TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
      "_ilGetInteger", referenced from:
          TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
          TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
          TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
          TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
      "_ilDeleteImages", referenced from:
          TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
          TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
          TextureManager::loadTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, unsigned int, unsigned int, bool, bool)in TextureManager.o
      "_main", referenced from:
          start in crt1.10.6.o
         (maybe you meant: _SDL_main)
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    

    显然 .dylib

    非常感谢你的帮助!

    1 回复  |  直到 15 年前
        1
  •  1
  •   Patrick Oscity    12 年前

    我通过将brew公式编辑为:

    def install
      system "./configure", "--disable-debug", "--disable-dependency-tracking",
                            "--prefix=#{prefix}", "--enable-ILU", "--enable-ILUT",
                            "CFLAGS=-arch i386", "CXXFLAGS=-arch i386"
      system "make install"
    end
    
    推荐文章