* libpng problem -- png_read_destroy
@ 2001-01-02 21:06 Jong B. Lee
2001-01-02 21:45 ` Charles Wilson
0 siblings, 1 reply; 2+ messages in thread
From: Jong B. Lee @ 2001-01-02 21:06 UTC (permalink / raw)
To: cygwin; +Cc: cwilson
Happy New Year !!
I'm writing a program using png library.
But, gcc complains that png_read_destroy and png_write_destroy are undefined.
How can I fix it?
I have the latest and clean cygwin installed.
Here's a sample c file and link error :
------------------------------------
/* sample png.c */
#include <png.h>
int main()
{
#ifdef __CYGWIN__
#define PNG_STATIC
#endif
png_structp pp;
png_infop info;
png_read_end(pp, info);
png_read_destroy(pp, info, NULL);
png_write_destroy (pp);
return 0;
}
-------------------------------------
$ gcc -W -g png.c -lpng -o png
/c/WINDOWS/TEMP/ccFXASfF.o(.text+0x30): undefined reference to `png_read_destroy'
/c/WINDOWS/TEMP/ccFXASfF.o(.text+0x3f): undefined reference to `png_write_destroy'
collect2: ld returned 1 exit status
===============================
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: libpng problem -- png_read_destroy
2001-01-02 21:06 libpng problem -- png_read_destroy Jong B. Lee
@ 2001-01-02 21:45 ` Charles Wilson
0 siblings, 0 replies; 2+ messages in thread
From: Charles Wilson @ 2001-01-02 21:45 UTC (permalink / raw)
To: Jong B. Lee; +Cc: cygwin
Two solutions:
a) link using 'gcc -static'. You must also define ZLIB_STATIC (see
/usr/doc/Cygwin/libpng-x.x.x.README).
OR
b) DON'T define PNG_STATIC.
--Chuck
"Jong B. Lee" wrote:
>
> Happy New Year !!
>
> I'm writing a program using png library.
>
> But, gcc complains that png_read_destroy and png_write_destroy are undefined.
>
> How can I fix it?
>
> I have the latest and clean cygwin installed.
>
> Here's a sample c file and link error :
>
> ------------------------------------
> /* sample png.c */
> #include <png.h>
>
> int main()
> {
> #ifdef __CYGWIN__
> #define PNG_STATIC
> #endif
>
> png_structp pp;
> png_infop info;
> png_read_end(pp, info);
> png_read_destroy(pp, info, NULL);
> png_write_destroy (pp);
>
> return 0;
> }
> -------------------------------------
> $ gcc -W -g png.c -lpng -o png
>
> /c/WINDOWS/TEMP/ccFXASfF.o(.text+0x30): undefined reference to `png_read_destroy'
> /c/WINDOWS/TEMP/ccFXASfF.o(.text+0x3f): undefined reference to `png_write_destroy'
> collect2: ld returned 1 exit status
> ===============================
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-01-02 21:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-02 21:06 libpng problem -- png_read_destroy Jong B. Lee
2001-01-02 21:45 ` Charles Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).