Problems with fink installed libpng at runtime

Posts: 22
Joined: 2006.04
Post: #1
I am attempting to use the libpng library that I installed using fink into /sw (as it seems to do by default). Being pretty new to all this stuff, - I've not tried using a library like this before - I wrote as simple a program as I could to see if what I'd installed would work:

#include <png.h>
#include <stdio.h>

int main()
    char filename[] = "clare.png";
    bool is_png;
    png_byte header[4];
    size_t number = 4;
    FILE *fp = fopen(filename, "rb");
    if (!fp)
        printf("Error opening file.\n");
        return (1);
    fread(header, 1, number, fp);
    is_png = !png_check_sig(header, number);
    if (!is_png)
        printf("Not a PNG.\n");

After reading about (a lot) I configured the active target search paths to /sw/include and /sw/lib, and I used -lpng in Other Linker Flags. I've tried changing all sorts of other things too.

The program compiles without warnings, but when I run it I get the following:

ZeroLink: unknown symbol '_png_check_sig'

libpngtest has exited due to signal 6 (SIGABRT).

If I 'Jump to Definition' for png_check_sig XCode displays the libpng header file. I've tried other functions from the library. I'm sure this must be something really simple but I'm stuck. Any help would be really appreciated.

Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #2
Turn off ZeroLink, then fix the linker error.
Quote this message in a reply
Posts: 22
Joined: 2006.04
Post: #3
Ok, so I did that, cleaned the target and on building I got a warning, but then I realised I've been making a mistake all along - the active build style seems to override any edits I make to the current target - oops. So XCode has been expecting static libraries all along...

Thanks for the help - I knew I'd done something silly.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Is -fconstant-string-class broken under the XCode/Next runtime Justin Brimm 17 10,015 Jun 12, 2008 01:04 PM
Last Post: Justin Brimm
  Loading Textures in OpenGL using libpng Taxxodium 9 17,010 Apr 4, 2006 09:21 PM
Last Post: glMatt
  Linker error when using libPNG TomorrowPlusX 4 6,227 Nov 18, 2004 02:19 PM
Last Post: TomorrowPlusX