include files in Xcode

Member
Posts: 321
Joined: 2004.10
Post: #1
Another stupid question, but please, humiliate me. Smile

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.
Quote this message in a reply
Member
Posts: 198
Joined: 2005.01
Post: #2
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.

Cryptic Allusion Games / Cryptic Allusion, LLC
http://www.cagames.com/
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #3
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.

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #4
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?
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #5
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?
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #6
Did you include -lpng in your link options?

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #7
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  C++ with SDL2 Framework: Loading .bmp files in same folder in XCode 5 on Mavericks exitcode 1 1,139 Feb 23, 2014 11:15 PM
Last Post: SethWillits
  StorageRoom - Include content in your games sashthebash 0 2,538 Jun 13, 2011 05:39 AM
Last Post: sashthebash
  Why won't Xcode even try compiling my .cpp files?? SparkyNZ 11 14,115 Apr 3, 2011 01:44 PM
Last Post: AnotherJake
  #include &lt;ft2build.h&gt; BBBert 4 10,755 Apr 7, 2008 09:33 AM
Last Post: BBBert
  Newbie problem XCode Include files BBBert 1 4,386 Mar 17, 2008 03:46 PM
Last Post: OneSadCookie