Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » jpeg alleg library issue

This thread is locked; no one can reply to it. rss feed Print
 1   2   3 
jpeg alleg library issue
A J
Member #3,025
December 2002
avatar

X-G your smarter than me, im stupid, please explain to me what i should have done.

i have zero clue about how to make zconf.h work for msvc.

___________________________
The more you talk, the more AJ is right. - ML

X-G
Member #856
December 2000
avatar

Read my last edit. The complete packages do contain zlib.h and all the other things you need.

Personally I'm a bit offended by you blaming all the problems you are having on the packages being faulty when there is absolutely nothing wrong with them; in fact, the outright lie that the zlib complete package does not contain zlib.h is appalling.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Peter Wang
Member #23
April 2000

I didn't realise gnuwin32 binaries were usable with MSVC. Now I'm trying to make a version of this howto for MSVC. Here's what I've got so far, but it's completely untested. I don't know what to do about step 3 either.

UPDATED:

Quote:

1. Download the precompiled zlib and libpng packages from http://gnuwin32.sourceforge.net

For the extremely lazy, just left-click these:
* http://gnuwin32.sourceforge.net/downlinks/libpng.php
* http://gnuwin32.sourceforge.net/downlinks/zlib.php

It looks like you DON'T need this:
* http://gnuwin32.sourceforge.net/downlinks/libgw32c.php

2.
Run the installers just downloaded. When prompted, point them to your MSVC root directory, e.g. c:\msvc (it should contain the 'include' and 'lib' directories directly inside it). You don't need to install the documentation or download sources if you don't want to.

2b. Open up the zconf.h in your MSVC include directory. Search for the line "#if 1 /* HAVE_UNISTD_H ... */" and replace it with "#if 0 /* HAVE_UNISTD_H ... */". zlib and libpng are now installed.

3.
To test loadpng, unzip loadpng somewhere. Open a command prompt (e.g. Start -> Run -> "cmd" on Windows XP), cd into the loadpng directory, and run [XXX: what should MSVC users do here?]. loadpng and its examples should be compiled.

4.
To use loadpng in your own application, I suggest you copy loadpng's source files into your own project directory and compile them as if they were your own files. Otherwise you may do whatever it is MSVC users do to turn loadpng into a library and install it on your system.

5.
When linking your own programs, remember that you need to link in the zlib and libpng libraries, as well as loadpng itself.

A J
Member #3,025
December 2002
avatar

Quote:

the outright lie that the zlib complete package does not contain zlib.h is appalling

shall i provide you the link? that you suggested ?
maybe its best we ignore this, and continue on with the facts.

peter, i have just found a better source of MSVC compatible zlib/png .lib files.. i shall inform you of my findings in about an hour, when i get the loadpng files compiled.. its saying these:

1\png.cpp(18) : error C2440: 'initializing' : cannot convert from 'png_voidp' to 'PACKFILE *'
2 Conversion from 'void*' to pointer to non-'void' requires an explicit cast
3\png.cpp(38) : error C2440: '=' : cannot convert from 'void *' to 'unsigned char *'
4 Conversion from 'void*' to pointer to non-'void' requires an explicit cast
5\png.cpp(76) : error C2440: '=' : cannot convert from 'void *' to 'unsigned char *'
6 Conversion from 'void*' to pointer to non-'void' requires an explicit cast
7\png.cpp(281) : error C2440: 'initializing' : cannot convert from 'png_voidp' to 'PACKFILE *'
8 Conversion from 'void*' to pointer to non-'void' requires an explicit cast
9\png.cpp(300) : error C2664: 'png_sig_cmp' : cannot convert parameter 1 from 'char [4]' to 'png_bytep'
10 Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
11\png.cpp(559) : error C2440: 'initializing' : cannot convert from 'png_voidp' to 'MEMORY_READER_STATE *'
12 Conversion from 'void*' to pointer to non-'void' requires an explicit cast
13\png.cpp(575) : error C2664: 'png_sig_cmp' : cannot convert parameter 1 from 'void *' to 'png_bytep'
14 Conversion from 'void*' to pointer to non-'void' requires an explicit cast
15\png.cpp(626) : error C2440: '=' : cannot convert from 'const void *' to 'const char *'
16 Conversion from 'void*' to pointer to non-'void' requires an explicit cast

___________________________
The more you talk, the more AJ is right. - ML

Peter Wang
Member #23
April 2000

Compile as C. I'll see about making it C++ compatible some other time (or send a patch).

Oscar Giner
Member #2,207
April 2002
avatar

What's that libgw32c library you're talking about? I've been using loadpng for some time and I've never needed that ???

Quote:

Googling for 'gnuwin32 libpng'

Why anyone who is looking for a msvc package would google for that?

The oficial distribution comes with a msvc project, so that one should work. Now download zlib from the official page. Uncompress zlib inside a folder named zlib at the same level where you put libpng (so if you have libpng at c:\libs\lpng128, you should put zlib at c:\libs\zlib). Open the loadpng workspace (or solution if using 7.x) and compile (you'll notice this workspace also has a zlib project so you can compile it easily, that's why it's important where you decompressed zlib).

[edit]
Now, how this conversation changed from libjpeg to libpng ???

X-G
Member #856
December 2000
avatar

Quote:

shall i provide you the link? that you suggested ?

Please do. In the meantime:

The page I linked you to is this. On that page, under the header "Requirements", is a link named "zlib" that leads here. On that page is a package called "Complete package, except sources". That's the one you claimed to have downloaded:

Quote:

i tried downloading what is called the "Complete package" off the link you provided, and its missing a zlib.h
...
so i go back to your suggested link, to download "dependacies" as clearly zlib is a dependancy. and guess what.. it doesn't contain zlib.h

This file installs, among other files:

  • lib/libz.a

  • lib/libz.dll.a

  • lib/libz.lib

  • lib/libz-bcc.lib

  • include/zlib.h

</li>

To claim anything else is an utter lie. I don't know, maybe you failed to realize that the things listed under "Requirements" are actually required for it to work? Maybe you just got the run-time dependency file... still, that's hardly a problem with the packaging. It's all there, black on white.

Quote:

Why anyone who is looking for a msvc package would google for that?

Typically because they know that Gnuwin32 is a collection of GNU libraries and tools ported to Windows. But even if one does not know that, the very same page is the top result of a search for libpng for windows — and you must agree it doesn't get more intuitive than that!

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Adriano Guido
Member #4,627
May 2004

okay, i got it. how do i load an image and then blit it? jpegalleg seemed to have a fairly simple method of doing so, i hope loadpng (or whatever it's called) is the same way.

Evert
Member #794
November 2000
avatar

jpgalleg and loadpng do basically the same thing: once you have initialized them, you can use Allegro's load_bitmap() function to load PNG and JPEG images into BITMAP structs. That's all they do.

Adriano Guido
Member #4,627
May 2004

oh okay, perfect. thanks

edit

-------------------Configuration: Tank Hunters - Win32 Debug-------------------
Compiling...
main.cpp
c:\program files\microsoft visual studio\vc98\include\zconf.h(283) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
Error executing cl.exe.

main.obj - 1 error(s), 0 warning(s)

not so perfect.

Peter Wang
Member #23
April 2000

Search this thread for libgw32c.

Adriano Guido
Member #4,627
May 2004

i already installed that. (using msvc, incase i need compiler specific tips)

Peter Wang
Member #23
April 2000

DON'T DO THIS:
Ok, I think you might need to move the contents of the 'include/glibc' directory into 'include' itself. Maybe there is a better way.

edit: or try just commenting out the unistd.h line in zconf.h

Adriano Guido
Member #4,627
May 2004

-------------------Configuration: Tank Hunters - Win32 Debug-------------------
Compiling...
main.cpp
c:\program files\microsoft visual studio\vc98\include\bits\errno.h(31) : fatal error C1083: Cannot open include file: '_mingw.h': No such file or directory
Error executing cl.exe.

main.obj - 1 error(s), 0 warning(s)

i also tried copying winx files to include, that didn't work.

Peter Wang
Member #23
April 2000

Grr. Try changing the "#if 1 /* HAVE_UNISTD_H ... */" line in zconf.h to "#if 0".

edit: crap, I hope I didn't mess up your MSVC installation when I asked you to move the include/glibc files into include. You probably will have to restore the MSVC versions of any files you overwrite.

Adriano Guido
Member #4,627
May 2004

same error

Peter Wang
Member #23
April 2000

See edit. Sorry about that.

Adriano Guido
Member #4,627
May 2004

ah.. yes you did... meh, i still have my source code, i'll just do a quick reinstall. but when i get back i expect an aswer that works or else! haha jk

Peter Wang
Member #23
April 2000

Right, I finally bothered to boot into Windows. I have a installation of the free version of MSVC that Microsoft provided, and I think I've got it to work. See my updated instructions above.

Adriano Guido
Member #4,627
May 2004

okay, once reinstall is done. ill post an update. if no one posts after me all i can do is an update to this post. (you all probably know that, but i don't post here alot so that was new to me)

Thomas Fjellstrom
Member #476
June 2000
avatar

bump

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Adriano Guido
Member #4,627
May 2004

it worked! i just don't know how to use it! :(

Peter Wang
Member #23
April 2000

Thanks for testing. I think all the information you need is in loadpng.h. Failing that, see the source.

A J
Member #3,025
December 2002
avatar

X-G, seems Adriano Guido has run into the exact same problem i did.
(zconf.h requiring unistd.h)
so installing zlib for png for loadpng is not as "black on white" as you think.

Peter, X-G, thank you for your help. im glad its getting resolved.

Peter, apolgies for not getting back to you sooner, i just moved by 40gig to a new box, new HD's, new OS, so have had 2 days downtime :(
is setting up RAID always been this hard?
(mobo supplied RAID drivers were buggy.)

___________________________
The more you talk, the more AJ is right. - ML

Oscar Giner
Member #2,207
April 2002
avatar

Quote:

X-G, seems Adriano Guido has run into the exact same problem i did.
(zconf.h requiring unistd.h)

But from where did you download zlib? The official zlib zip doesn't need unistd.h.

Really, I think you guys are doing it the hard path. The official distributions (of both zlib and libong) work perfectly with MSVC, without requiring any extra lib...

 1   2   3 


Go to: