Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode 4.0.2 SOIL library link errors (OSX 10.6.8)

Tags:

xcode

soil

My user story: I want to load a texture into my openGL program.

My question: How do I link the SOIL library properly in xcode 4.0.2

So, I've been googling over the past few days regarding my linker warnings in xcode4, and am unable to answer it for myself - so I'm daring to post another thread on the subject... (humble beginner tucks tail between legs).

My bare-bone repro steps:

  1. I unzip the 'Simple OpenGL Image Library' to my downloads
  2. I drag/drop libSOIL.a to my project file

    • Under 'Build Phases', libSOIL.a is automatically added to 'Link Binary With Libraries'
    • Under 'Build Settings', my Library Search Paths is also automatically updated
    • my Valid Architectures already specify "i386 x86_64"

I get this warning when I try to run my program:

ld: warning: ignoring file /Users/Scott/Developer/Projects/SpaceRanger/Code/Production/lib/libSOIL.a, file was built for archive which is not the architecture being linked (x86_64)

As I mentioned, I'm quite new to programming and IDE's in general, so I was hoping that a simpler approach to loading textures in OpenGL (e.g. SOIL) would be favorable to SDL or even GLFW for that matter. If I'm having this sort of trouble loading only a library, those must absolutely be out of my league.

Other Hit n' Miss attempts based on searching:

  • adding the library to 'Compile Sources' only generating more warnings
  • toggling 'Build Active Architecture Only' Yes/No
  • setting schemes to 32 and 64 bit
  • writing my own texture loader, employing libjpg/DevIL/etc.

I'm afraid I'm beginning to mangle my project just trying to link this library. If someone could help me to link the SOIL library properly in xcode 4.0.2, I would be eternally grateful.

Thank you deeply in advance.

-kropcke

like image 908
kropcke Avatar asked Aug 29 '12 18:08

kropcke


1 Answers

I would like to add to this, it's driven me insane over last few days. As well as all the above, I had to ensure of the following.

In Project > Target > Build Phases, under 'Compile Sources', need to add the .c SOIL files:

image_DXT.c, image_helper.c, SOIL.c, stb_image_aug.c.

Only now would it compile and run.

// not sure why downvote, would appreciate reason!

like image 53
chillok Avatar answered Oct 06 '22 00:10

chillok