Menu

Buliding libpng for using pngwriter

Y S
2008-03-10
2012-09-26
  • Y S

    Y S - 2008-03-10

    Hey i have downloaded pngwriter and freetype2. I am using winbdow xp and dev C++. However i still did not successfully compile to create the libpngwriter.a file when i try to follow the instruction for pngwriter window user http://pngwriter.sourceforge.net/

    So far i have created a new project libpngwriter and added pngwriter.h and pngwriter.cpp files to the project. However i am not too sure what to put for the parameter in the project option. Right now i put -lfreetype -lz -lpng under linker column.
    I saved both pngwriter and freetype in C:\Dev-cpp folder. As for directories of project option i put
    Libraries directories: C:\Dev-Cpp\GnuWin32\lib
    Include Directories:
    C:\Dev-Cpp\GnuWin32\include\freetype2
    C:\Dev-Cpp\GnuWin32\include\freetype2\freetype\config
    C:\Dev-Cpp\GnuWin32\include\freetype2\freetype
    C:\Dev-Cpp\GnuWin32\include

    When i try to compile pngwriter.cpp i got error msg. Please help me!
    Below are copied rom my compiler log:

    Compiler: Default compiler
    Building Makefile: "C:\Dev-Cpp\Makefile.win"
    Executing make...
    make.exe -f "C:\Dev-Cpp\Makefile.win" all
    g++.exe -c pngwriter-0.5.3/src/pngwriter.cpp -o pngwriter-0.5.3/src/pngwriter.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -I"C:/Dev-Cpp/GnuWin32/include" -I"C:/Dev-Cpp/GnuWin32/include/freetype2/freetype" -I"C:/Dev-Cpp/GnuWin32/include/freetype2/freetype/config" -I"C:/Dev-Cpp/GnuWin32/include/freetype2" -DNO_FREETYPE

    In file included from pngwriter-0.5.3/src/pngwriter.cpp:42:
    pngwriter-0.5.3/src/pngwriter.h:48:17: png.h: No such file or directory
    In file included from pngwriter-0.5.3/src/pngwriter.cpp:42:
    pngwriter-0.5.3/src/pngwriter.h:115: error: png_structp' has not been declared pngwriter-0.5.3/src/pngwriter.h:115: error:png_infop' has not been declared
    pngwriter-0.5.3/src/pngwriter.h:115: error: ISO C++ forbids declaration of png_ptr' with no type pngwriter-0.5.3/src/pngwriter.h:115: error: ISO C++ forbids declaration ofinfo_ptr' with no type
    pngwriter-0.5.3/src/pngwriter.h:116: error: png_structp' has not been declared pngwriter-0.5.3/src/pngwriter.h:116: error:png_infop' has not been declared
    pngwriter-0.5.3/src/pngwriter.h:117: error: png_bytepp' has not been declared pngwriter-0.5.3/src/pngwriter.h:117: error:png_uint_32' has not been declared
    pngwriter-0.5.3/src/pngwriter.h:117: error: png_uint_32' has not been declared pngwriter-0.5.3/src/pngwriter.h:117: error: ISO C++ forbids declaration ofpng_ptr' with no type
    pngwriter-0.5.3/src/pngwriter.h:117: error: ISO C++ forbids declaration of info_ptr' with no type pngwriter-0.5.3/src/pngwriter.h:117: error: ISO C++ forbids declaration ofimage' with no type
    pngwriter-0.5.3/src/pngwriter.h:117: error: ISO C++ forbids declaration of width' with no type pngwriter-0.5.3/src/pngwriter.h:117: error: ISO C++ forbids declaration ofheight' with no type

    pngwriter-0.5.3/src/pngwriter.cpp: In constructor pngwriter::pngwriter()': pngwriter-0.5.3/src/pngwriter.cpp:73: error:png_bytepp' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:73: error: (Each undeclared identifier is reported only once for each function it appears in.)
    pngwriter-0.5.3/src/pngwriter.cpp:73: error: expected ;' before "malloc" pngwriter-0.5.3/src/pngwriter.cpp:81: error:png_bytep' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:81: error: expected `;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp: In copy constructor pngwriter::pngwriter(const pngwriter&)': pngwriter-0.5.3/src/pngwriter.cpp:139: error:png_bytepp' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:139: error: expected ;' before "malloc" pngwriter-0.5.3/src/pngwriter.cpp:147: error:png_bytep' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:147: error: expected `;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp: In constructor pngwriter::pngwriter(int, int, int, char*)': pngwriter-0.5.3/src/pngwriter.cpp:223: error:png_bytepp' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:223: error: expected ;' before "malloc" pngwriter-0.5.3/src/pngwriter.cpp:231: error:png_bytep' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:231: error: expected `;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp: In constructor pngwriter::pngwriter(int, int, double, char*)': pngwriter-0.5.3/src/pngwriter.cpp:308: error:png_bytepp' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:308: error: expected ;' before "malloc" pngwriter-0.5.3/src/pngwriter.cpp:316: error:png_bytep' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:316: error: expected `;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp: In constructor pngwriter::pngwriter(int, int, int, const char*)': pngwriter-0.5.3/src/pngwriter.cpp:407: error:png_bytepp' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:407: error: expected `;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp:415: error: `png_bytep' undeclared (first use this function)

    pngwriter-0.5.3/src/pngwriter.cpp:415: error: expected `;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp: In constructor pngwriter::pngwriter(int, int, double, const char*)': pngwriter-0.5.3/src/pngwriter.cpp:492: error:png_bytepp' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:492: error: expected `;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp:500: error: `png_bytep' undeclared (first use this function)

    pngwriter-0.5.3/src/pngwriter.cpp:500: error: expected `;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp: In member function pngwriter& pngwriter::operator=(const pngwriter&)': pngwriter-0.5.3/src/pngwriter.cpp:562: error:png_bytepp' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:562: error: expected `;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp:570: error: `png_bytep' undeclared (first use this function)

    pngwriter-0.5.3/src/pngwriter.cpp:570: error: expected `;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp: In member function void pngwriter::close()': pngwriter-0.5.3/src/pngwriter.cpp:942: error:png_structp' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:942: error: expected ;' before "png_ptr" pngwriter-0.5.3/src/pngwriter.cpp:943: error:png_infop' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:943: error: expected `;' before "info_ptr"

    pngwriter-0.5.3/src/pngwriter.cpp:953: error: png_ptr' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:953: error:PNG_LIBPNG_VER_STRING' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:953: error: png_create_write_struct' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:954: error:info_ptr' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:954: error: png_create_info_struct' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:955: error:png_init_io' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:958: error: png_set_compression_level' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:966: error:PNG_COLOR_TYPE_RGB' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:966: error: PNG_INTERLACE_NONE' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:967: error:PNG_COMPRESSION_TYPE_DEFAULT' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:967: error: PNG_FILTER_TYPE_DEFAULT' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:967: error:png_set_IHDR' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:974: error: png_set_gAMA' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:977: error:png_time' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:977: error: expected ;' before "mod_time" pngwriter-0.5.3/src/pngwriter.cpp:978: error:png_text' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:978: error: expected ;' before "text_ptr" pngwriter-0.5.3/src/pngwriter.cpp:980: error:mod_time' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:980: error: png_convert_from_time_t' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:981: error:png_set_tIME' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:982: error: text_ptr' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:984: error:PNG_TEXT_COMPRESSION_NONE' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:992: error: png_convert_to_rfc1123' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:997: error:png_set_text' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:999: error: png_write_info' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1000: error:png_write_image' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:1001: error: png_write_end' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1002: error:png_destroy_write_struct' undeclared (first use this function)

    pngwriter-0.5.3/src/pngwriter.cpp: In member function void pngwriter::readfromfile(char*)': pngwriter-0.5.3/src/pngwriter.cpp:1195: error:png_structp' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:1195: error: expected ;' before "png_ptr" pngwriter-0.5.3/src/pngwriter.cpp:1196: error:png_infop' undeclared (first use this function)

    pngwriter-0.5.3/src/pngwriter.cpp:1196: error: expected ;' before "info_ptr" pngwriter-0.5.3/src/pngwriter.cpp:1219: error:png_ptr' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:1219: error: info_ptr' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1254: error:png_get_rowbytes' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:1256: error: png_get_IHDR' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1260: error:PNG_COLOR_TYPE_PALETTE' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:1262: error: png_set_expand' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1265: error:PNG_COLOR_TYPE_GRAY' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:1270: error: PNG_COLOR_MASK_ALPHA' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1272: error:png_set_strip_alpha' undeclared (first use this function)

    pngwriter-0.5.3/src/pngwriter.cpp:1275: error: `PNG_COLOR_TYPE_RGB_ALPHA' undeclared (first use this function)

    pngwriter-0.5.3/src/pngwriter.cpp:1277: error: png_set_gray_to_rgb' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1293: error:png_get_gAMA' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:1295: error: `png_set_gamma' undeclared (first use this function)

    pngwriter-0.5.3/src/pngwriter.cpp: In member function int pngwriter::check_if_png(char*, FILE**)': pngwriter-0.5.3/src/pngwriter.cpp:1336: error:png_bytep' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:1336: error: png_size_t' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1336: error:png_sig_cmp' undeclared (first use this function)

    pngwriter-0.5.3/src/pngwriter.cpp: At global scope:
    pngwriter-0.5.3/src/pngwriter.cpp:1349: error: png_structp' has not been declared pngwriter-0.5.3/src/pngwriter.cpp:1349: error:png_infop' has not been declared
    pngwriter-0.5.3/src/pngwriter.cpp:1350: error: ISO C++ forbids declaration of png_ptr' with no type pngwriter-0.5.3/src/pngwriter.cpp:1350: error: ISO C++ forbids declaration ofinfo_ptr' with no type
    pngwriter-0.5.3/src/pngwriter.cpp: In member function int pngwriter::read_png_info(FILE*, int*, int*)': pngwriter-0.5.3/src/pngwriter.cpp:1351: error:PNG_LIBPNG_VER_STRING' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:1351: error: png_create_read_struct' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1352: warning: NULL used in arithmetic pngwriter-0.5.3/src/pngwriter.cpp:1359: error:png_create_info_struct' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:1360: warning: NULL used in arithmetic
    pngwriter-0.5.3/src/pngwriter.cpp:1362: error: png_infopp' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1362: error:png_destroy_read_struct' undeclared (first use this function)

    pngwriter-0.5.3/src/pngwriter.cpp:1368: error: base operand of ->' is not a pointer pngwriter-0.5.3/src/pngwriter.cpp:1376: error:png_init_io' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:1377: error: png_set_sig_bytes' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1378: error:png_read_info' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp: At global scope:
    pngwriter-0.5.3/src/pngwriter.cpp:1384: error: `png_structp' has not been declared

    pngwriter-0.5.3/src/pngwriter.cpp:1384: error: png_infop' has not been declared pngwriter-0.5.3/src/pngwriter.cpp:1385: error:png_bytepp' has not been declared
    pngwriter-0.5.3/src/pngwriter.cpp:1385: error: png_uint_32' has not been declared pngwriter-0.5.3/src/pngwriter.cpp:1385: error:png_uint_32' has not been declared
    pngwriter-0.5.3/src/pngwriter.cpp:1386: error: ISO C++ forbids declaration of png_ptr' with no type pngwriter-0.5.3/src/pngwriter.cpp:1386: error: ISO C++ forbids declaration ofinfo_ptr' with no type
    pngwriter-0.5.3/src/pngwriter.cpp:1386: error: ISO C++ forbids declaration of image' with no type pngwriter-0.5.3/src/pngwriter.cpp:1386: error: ISO C++ forbids declaration ofwidth' with no type
    pngwriter-0.5.3/src/pngwriter.cpp:1386: error: ISO C++ forbids declaration of height' with no type pngwriter-0.5.3/src/pngwriter.cpp: In member functionint pngwriter::read_png_image(FILE, int, int, int, int, int)':
    pngwriter-0.5.3/src/pngwriter.cpp:1389: error: png_get_image_width' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1390: error:png_get_image_height' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:1406: error: png_bytepp' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:1406: error: expected)' before "malloc"
    pngwriter-0.5.3/src/pngwriter.cpp:1413: error: expected )' before "for" pngwriter-0.5.3/src/pngwriter.cpp:1413: error: expected;' before ')' token

    pngwriter-0.5.3/src/pngwriter.cpp:1426: error: `png_read_image' undeclared (first use this function)

    pngwriter-0.5.3/src/pngwriter.cpp: In member function void pngwriter::resize(int, int)': pngwriter-0.5.3/src/pngwriter.cpp:2633: error:png_bytepp' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:2633: error: expected ;' before "malloc" pngwriter-0.5.3/src/pngwriter.cpp:2641: error:png_bytep' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:2641: error: expected `;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp: In member function void pngwriter::scale_k(double)': pngwriter-0.5.3/src/pngwriter.cpp:3041: error:png_bytepp' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:3041: error: expected ;' before "malloc" pngwriter-0.5.3/src/pngwriter.cpp:3049: error:png_bytep' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:3049: error: expected `;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp: In member function void pngwriter::scale_kxky(double, double)': pngwriter-0.5.3/src/pngwriter.cpp:3132: error:png_bytepp' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:3132: error: expected ;' before "malloc" pngwriter-0.5.3/src/pngwriter.cpp:3140: error:png_bytep' undeclared (first use this function)
    pngwriter-0.5.3/src/pngwriter.cpp:3140: error: expected ;' before "malloc" pngwriter-0.5.3/src/pngwriter.cpp: In member functionvoid pngwriter::scale_wh(int, int)':
    pngwriter-0.5.3/src/pngwriter.cpp:3227: error: png_bytepp' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:3227: error: expected;' before "malloc"

    pngwriter-0.5.3/src/pngwriter.cpp:3235: error: png_bytep' undeclared (first use this function) pngwriter-0.5.3/src/pngwriter.cpp:3235: error: expected;' before "malloc"

    make.exe: *** [pngwriter-0.5.3/src/pngwriter.o] Error 1

    Execution terminated

     
    • Musa

      Musa - 2008-03-13

      you'll have to compile zlib and libpng to make the static libraries (.a files z.a and png.a)

       
    • Tim Browning

      Tim Browning - 2008-03-10

      If there is an include directory somewhere in the "pngwriter-0.5.3/" directory tree, you need to add those to your project options.

      Project->Project Options

      Choose the "Directories" tab at the top.

      Under the "Include Directories" tab browse to your "pngwriter-0.5.3" directory and find the "include" directory.

      Click "Add"

      If there is no "include" directory in your "pngwriter-0.5.3/" directory tree, then you need to locate the "png.h" file and add that to your project.

       
    • cpns

      cpns - 2008-03-10

      Well, as teh message says: "pngwriter.h:48:17: png.h: No such file or directory"

      Where is png.h? you need to add that path to your project too.

       
    • Y S

      Y S - 2008-03-10

      Thanks for the reply. After i added png.h and zlib.h, the error reduced to just 'cannot find -lz' what shoudl i do?
      Note that i put '-lfreetype -lz -lpng' under the linker heading of parameters tab in project option

      From compiler log:
      Compiler: Default compiler
      Building Makefile: "C:\Dev-Cpp\Makefile.win"
      Executing make...
      make.exe -f "C:\Dev-Cpp\Makefile.win" all
      g++.exe pngwriter-0.5.3/src/pngwriter.o -o "libpngwriter.exe" -L"C:/Dev-Cpp/lib" -L"C:/Dev-Cpp/GnuWin32/lib" -lfreetype -lz -lpng

      C:\Dev-Cpp\Bin..\lib\gcc\mingw32\3.4.2........\mingw32\bin\ld.exe: cannot find -lz
      collect2: ld returned 1 exit status

      make.exe: *** [libpngwriter.exe] Error 1

      Execution terminated

       
      • cpns

        cpns - 2008-03-10

        A very similar problem. You have specified to paths for library searches: "C:/Dev-Cpp/lib" and "C:/Dev-Cpp/GnuWin32/lib". zlib.a does not exist in either of these. Either add the path that contains zlib.a, or use the full path and archive namee (you can do this by using the "Add Library or Object" button in the Parameters settings.

        Alternatively move zlib.a to C:/Dev-Cpp/GnuWin32/lib

        Clifford

         
    • Y S

      Y S - 2008-03-11

      Hey I am sorry for bothering again. But i cant find any zlib.a file at all. I even tried redownloading zlib123 and searched for it again. It also cannot find -lpng and i din manage to find any png.a file in either pngwriter nor lpng1225 too.

      PS: i genuinely need the help. That new thread i agree is a silly mistake bcos i keep changing the settings around in desparate attempt to make the pngwriter work.

      Still compiler log give:
      Compiler: Default compiler
      Building Makefile: "C:\Dev-Cpp\Makefile.win"
      Executing make...
      make.exe -f "C:\Dev-Cpp\Makefile.win" all
      g++.exe pngwriter-0.5.3/src/pngwriter.o -o "libpngwriter.exe" -L"C:/Dev-Cpp/lib" -L"C:/Dev-Cpp/GnuWin32/lib" -L"C:/Dev-Cpp/lib" -L"C:/Dev-Cpp/lpng1225" -L"C:/Dev-Cpp/zlib123" -L"C:/Dev-Cpp/zlib123-dll/lib" -lfreetype -lz -lpng

      C:\Dev-Cpp\Bin..\lib\gcc\mingw32\3.4.2........\mingw32\bin\ld.exe: cannot find -lz
      collect2: ld returned 1 exit status

      make.exe: *** [libpngwriter.exe] Error 1

      Execution terminated

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.