PDA

View Full Version : include files in Xcode


WhatMeWorry
2005.06.21, 05:17 PM
Another stupid question, but please, humiliate me. :)

I'm getting rid of my Targa files in my old OS 9 application and I'm trying to
move over to PNG files. I went into fink and downloaded the libpng3 package.

In my Xcode project main.cpp file, I inserted a #include <png.h>

The compiler keeps complaining about not finding png.h file. So,
I went into

Project Info -> Collection -> Header Search Paths and entered
/sw/include/libpng12

But the compiler is still not finding png.h Is /sw/include/libpng12 the "real"
path. I noticed in the Finder, the path for png.h shows:
Macintosh HD/sw/include/libpng12/png.h

Should I be including the Hard Drive in my paths or is it ignored? If so,
what string does Macintosh HD become? Is it "Macintosh_HD" ?

thanks.

Dan Potter
2005.06.21, 05:49 PM
You've got to be careful with your path conventions. The Finder path is actually "Macintosh HD:sw:include:libpng12:png.h". The Unix path is "/sw/include/libpng12/png.h". The latter is the only important one for dealing with Xcode.

I think to get it to use your include path, you'll actually have to put that in a build setting. Also it probably should be /sw/include, right? If this is Fink you're dealing with.

Steven
2005.06.21, 09:51 PM
I believe that png.h should be in /sw/include, with it including various files in the /sw/include/libpng12 by itself. Try Dan's suggestion.

WhatMeWorry
2005.06.21, 11:49 PM
Yes, you are correct. The png.h is in the /sw/include directory.

However, the this stupid programmer (random typist) forgot to put a
# before the include.

Say, noticed that in the Target "MyProject" Info screen, the Header Search Paths
was stuck through with a line. Does anybody know why? Is this because a Header
Search Path was defined in the Project "MyProject" Info screen?

WhatMeWorry
2005.06.22, 12:30 AM
Now Xcode can't find definitions for my first png function: readpng_init(__sFile*,
long*, long*)

I put
/sw/bin
/sw/sbin
/sw/lib
in the Library Search Paths of info page. I've been perusing within
all the folders under sw, but how can I tell where all the png function
definitions reside?

Steven
2005.06.22, 05:00 PM
Did you include -lpng in your link options?

WhatMeWorry
2005.06.22, 10:07 PM
No. But I'm trying now. There appears to be (Using the File->Get Info command)
link settings under the Project and Target. I put -lpng in "Other Linker Flags" field
of the Project. When I went to the Target linker screen, the Other Link Flags was
struck through with a line.

I re-compiled and this time I got a "can't open: -lpng (no such file or directory).

Guess that wasn't the right place. But all the other linking "settings" don't seem to
make much sense: Library Routine, Prebinding, ZeroLink, Exported Symbols File... etc.