Thread: Cannot understand this syntax in png.h

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2009
    Location
    Bozen
    Posts
    95
    I actually get the problem with other functions of the same file but not for variables defined in the same.

    Code:
    png_byte color_type;
    png_byte bit_depth;
    
    png_structp png_ptr;
    png_infop info_ptr;
    
    png_bytep * row_pointers;
    All of these are recognized. I guess if there was a linking problem to the library they would also be undefined references, or not?

    I found in the distribution of pnglib the c file that defines the function. However including it should not be required since I've the libpng.LIB in the lib folder.

    I'm using Eclipse with MinGW.
    Last edited by simpatico_qa; 08-11-2009 at 09:37 AM.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by simpatico_qa View Post
    I actually get the problem with other functions of the same file but not for variables defined in the same.

    Code:
    png_byte color_type;
    png_byte bit_depth;
    
    png_structp png_ptr;
    png_infop info_ptr;
    
    png_bytep * row_pointers;
    All of these are recognized. I guess if there was a linking problem to the library they would also be undefined references, or not?

    I found in the distribution of pnglib the c file that defines the function. However including it should not be required since I've the libpng.LIB in the lib folder.

    I'm using Eclipse with MinGW.
    You've found libpng.lib, which is good. Now you need to tell Eclipse that it exists. I've not used it, so I don't know exactly where to look, but you need to look for something like "linker options" and then "library paths"/"libraries to include"/etc.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Location
    Bozen
    Posts
    95
    I've tried adding it to the library paths in eclipse, as well as -l libpng, libpng.a, libpng.lib, from the linker options, but in vain.
    I've also tried from the prompt:

    C:\Documents and Settings\Simpatico\My Documents\ws\Test>make -I C:\MinGW\libpn
    \include\libpng12 test test.c -l libpng
    gcc test.c -o test
    test.c:6:17: png.h: No such file or directory
    test.c:20: error: syntax error before "color_type"
    test.c:20: warning: data definition has no type or storage class
    test.c:21: error: syntax error before "bit_depth"
    test.c:21: warning: data definition has no type or storage class
    test.c:22: error: syntax error before "png_ptr"
    test.c:22: warning: data definition has no type or storage class
    test.c:23: error: syntax error before "info_ptr"
    test.c:23: warning: data definition has no type or storage class
    test.c:25: error: syntax error before '*' token
    test.c:25: warning: data definition has no type or storage class
    test.c: In function `write_png_file':
    test.c:36: error: `PNG_LIBPNG_VER_STRING' undeclared (first use in this functio
    )
    test.c:36: error: (Each undeclared identifier is reported only once
    test.c:36: error: for each function it appears in.)
    test.c:56: error: `width' undeclared (first use in this function)
    test.c:56: error: `height' undeclared (first use in this function)
    test.c:57: error: `PNG_INTERLACE_NONE' undeclared (first use in this function)
    test.c:58: error: `PNG_COMPRESSION_TYPE_BASE' undeclared (first use in this fun
    tion)
    test.c:58: error: `PNG_FILTER_TYPE_BASE' undeclared (first use in this function

    test.c:78: warning: passing arg 1 of `free' makes pointer from integer without
    cast
    make: *** [test] Error 1

    C:\Documents and Settings\Simpatico\My Documents\ws\Test>
    Please help me getting it to compile at least in the prompt.

    -----

    Solved it. I've specified in the linker the name libpng in the -l option and in the -L was specified the path.
    Last edited by simpatico_qa; 08-12-2009 at 04:59 AM. Reason: Solved it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM