If I need a short command line utility style program, I don't use XCode -- I simply type it into TextWrangler and compile it with a line like this:
gcc -xc -g -o target source.c
Programs compiled as such run nicely under Lion, but under Snow Leopard I get a dylib loader error (from memory: 0081h -- but I don't think that's the issue). If I compile the same program under Snow Leopard, it runs on both SL and Lion, so it's not a problem in the code.
What is the magic invocation to have gcc compile for SL? I tried this
gcc -xc -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min='10.6
and I got the same problem. (Based loosely on hints found elsewhere, by the way.) Is there more to this?
If I remember correctly, the previous XCode version could helpfully show gcc output flags, but it seems the current IDE 4.2 no longer does this ... Oh, and I just compiled using XCode and having "10.6" as target -- it compiled just fine. But of course I cannot test if it actually runs under SL until tomorrow ...
Just for funsies, I tried to locate MacOSX10.5.sdk (Leopard) but it seems that's not included in this XCode installation. No way to go but forward, eh?
You need to keep your old SDKs around if you want to keep support for older systems. You may be able to get that from Xcode 3.2.6. I say upgrade that thing and move on