when i run jpeg alleg i get these link errors, i compiled it and it seemed to have succeded and also i linked it (msvc6) and included the headers and init. any ideas?
1 | --------------------Configuration: Tank Hunters - Win32 Debug-------------------- |
2 | Linking... |
3 | MSVCRT.lib(MSVCRT.dll) : error LNK2005: _free already defined in LIBCD.lib(dbgheap.obj) |
4 | MSVCRT.lib(MSVCRT.dll) : error LNK2005: _malloc already defined in LIBCD.lib(dbgheap.obj) |
5 | MSVCRT.lib(MSVCRT.dll) : error LNK2005: _calloc already defined in LIBCD.lib(dbgheap.obj) |
6 | MSVCRT.lib(MSVCRT.dll) : error LNK2005: _floor already defined in LIBCD.lib(floor.obj) |
7 | LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library |
8 | libjpgal.lib(decode.obj) : error LNK2001: unresolved external symbol __rgb_b_shift_24 |
9 | libjpgal.lib(decode.obj) : error LNK2001: unresolved external symbol __rgb_g_shift_24 |
10 | libjpgal.lib(decode.obj) : error LNK2001: unresolved external symbol __rgb_r_shift_24 |
11 | libjpgal.lib(encode.obj) : error LNK2001: unresolved external symbol __rgb_r_shift_32 |
12 | libjpgal.lib(encode.obj) : error LNK2001: unresolved external symbol __rgb_g_shift_32 |
13 | libjpgal.lib(encode.obj) : error LNK2001: unresolved external symbol __rgb_b_shift_32 |
14 | Debug/Tank Hunters.exe : fatal error LNK1120: 6 unresolved externals |
15 | Error executing link.exe. |
16 | |
17 | Tank Hunters.exe - 11 error(s), 1 warning(s) |
Try changing the linking order.
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib hawknl.lib alleg.lib libjpgal.lib
is my order now.. what order should i change it too?
just swap alleg and libjpgal
Note that I'm not sure this is causing the problem, but it's worth a try.
-------------------Configuration: Tank Hunters - Win32 Debug-------------------
Linking...
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _free already defined in LIBCD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _malloc already defined in LIBCD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _calloc already defined in LIBCD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _floor already defined in LIBCD.lib(floor.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
libjpgal.lib(decode.obj) : error LNK2001: unresolved external symbol __rgb_b_shift_24
libjpgal.lib(decode.obj) : error LNK2001: unresolved external symbol __rgb_g_shift_24
libjpgal.lib(decode.obj) : error LNK2001: unresolved external symbol __rgb_r_shift_24
libjpgal.lib(encode.obj) : error LNK2001: unresolved external symbol __rgb_r_shift_32
libjpgal.lib(encode.obj) : error LNK2001: unresolved external symbol __rgb_g_shift_32
libjpgal.lib(encode.obj) : error LNK2001: unresolved external symbol __rgb_b_shift_32
Debug/Tank Hunters.exe : fatal error LNK1120: 6 unresolved externals
Error executing link.exe.
Tank Hunters.exe - 11 error(s), 1 warning(s)
nope
Order doesn't matter with MSVC. For the first 4 errors, add libcd (for debug build) or libc (for release build) to the list of omitted standard libs (it should be in some place in the linker settings).
with libcd on the ignore list
1 | --------------------Configuration: Tank Hunters - Win32 Debug-------------------- |
2 | Linking... |
3 | main.obj : error LNK2001: unresolved external symbol _errno |
4 | libjpgal.lib(decode.obj) : error LNK2001: unresolved external symbol __rgb_b_shift_24 |
5 | libjpgal.lib(decode.obj) : error LNK2001: unresolved external symbol __rgb_g_shift_24 |
6 | libjpgal.lib(decode.obj) : error LNK2001: unresolved external symbol __rgb_r_shift_24 |
7 | libjpgal.lib(encode.obj) : error LNK2001: unresolved external symbol __rgb_r_shift_32 |
8 | libjpgal.lib(encode.obj) : error LNK2001: unresolved external symbol __rgb_g_shift_32 |
9 | libjpgal.lib(encode.obj) : error LNK2001: unresolved external symbol __rgb_b_shift_32 |
10 | libcid.lib(filebuf1.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,int,char const *,int)" (??2@YAPAXIHPBDH@Z) |
11 | libcid.lib(streamb.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,int,char const *,int)" (??2@YAPAXIHPBDH@Z) |
12 | libcid.lib(ifstream.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,int,char const *,int)" (??2@YAPAXIHPBDH@Z) |
13 | libcid.lib(_ios.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,int,char const *,int)" (??2@YAPAXIHPBDH@Z) |
14 | libcid.lib(iostrini.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,int,char const *,int)" (??2@YAPAXIHPBDH@Z) |
15 | libcid.lib(ofstream.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,int,char const *,int)" (??2@YAPAXIHPBDH@Z) |
16 | libcid.lib(filebuf.obj) : error LNK2001: unresolved external symbol ___pioinfo |
17 | Debug/Tank Hunters.exe : fatal error LNK1120: 9 unresolved externals |
18 | Error executing link.exe. |
19 | |
20 | Tank Hunters.exe - 15 error(s), 0 warning(s) |
Did you compile libjpgal yourself? If so, make sure it's using Multithreaded DLL, and make sure your app is also using that.
Do you have code generation (in C/C++ tab, IIRC) set to Multithreaded (Debug) DLL?
yay down to 7 errors
-------------------Configuration: Tank Hunters - Win32 Debug-------------------
Linking...
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
libjpgal.lib(decode.obj) : error LNK2001: unresolved external symbol __rgb_b_shift_24
libjpgal.lib(decode.obj) : error LNK2001: unresolved external symbol __rgb_g_shift_24
libjpgal.lib(decode.obj) : error LNK2001: unresolved external symbol __rgb_r_shift_24
libjpgal.lib(encode.obj) : error LNK2001: unresolved external symbol __rgb_r_shift_32
libjpgal.lib(encode.obj) : error LNK2001: unresolved external symbol __rgb_g_shift_32
libjpgal.lib(encode.obj) : error LNK2001: unresolved external symbol __rgb_b_shift_32
Debug/Tank Hunters.exe : fatal error LNK1120: 6 unresolved externals
Error executing link.exe.
Tank Hunters.exe - 7 error(s), 1 warning(s)
Hmm... my guess is that libjpgal.lib was not compiled with the same version of Allegro you have now.
any idea where i can get a binary for jpeg alleg? it'd be sooo much easier for me . switching to jpeg is my friends idea, he want's a smaller footprint on the ram. i really don't care i'm more concered about the networking problems.
switching to jpeg is my friends idea, he want's a smaller footprint on the ram
It won't affect RAM footprint to use JPEGs, since all it does it take the compressed file and decompressed it into RAM. So the footprint in RAM is the same. The footprint on the harddrive is much less, though.
oh, well tell that to him. heh. i guess i'll get back to working on networking (the thing that was always my job) and uhh, if anyone figures out this jpg library issue i'd appreciate an answer. thx
i use a jpg lib in msvc7 and have reduced it to a set of warnings that i have been ignoring for about a year
i had the same problems for a long time.
i dont know the answer, but my lib is currently "workable"
PM/email/ICQ contact details if you want my binarys.
Did you read Oscar's question about the multi-threaded DLL?
Also, ask yourself why you want to use JPEGs... they're good for backgrounds and textures, but they're not really suitable for things like srprites or tiles. You may have more luck looking into PNGs instead.
The png libs are a bit tricky to install, but they are more than worth the effort.
A BIT i dont think i have EVER had anything so hard.
even trying to find the download links of the zlib / png pages took 30 mins.
maybe for linux its easier.. but for MSVC.. you may as well write your own image format.. it would be quicker !
Er... your google-fu must be seriously weak. The last time I installed png/zlib for Win32 it took me about ten minutes total, and all I really had to do was unzip a couple of files.
Googling takes five seconds (the search term used was 'gnuwin32 libpng').
thank you.
i followed the links from the a.cc png wrapper app..
http://www.allegro.cc/resource/resource-view.php?id=21
please if you can, try to find a path from there to a download link.
http://sourceforge.net/project/showfiles.php?group_id=5624 is right on the page.
Also, that's not an Allegro PNG wrapper. The closest to that I know of is loadpng (which is also very easy to set up).
really... i have been doing so for the last 30 mins.
after much installing of weird pacakages, i now have a missing zlib.h
i tried downloading what is called the "Complete package" off the link you provided, and its missing a zlib.h
this is the type of thing im talking about.. so far i have looked about about 3 different sites, downloaded various "complete" packages to find bits missing, or blatantly just not there.
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 thats another 5 minutes.. its adding up fast.. i think i might have to call you a nasty name if i dont see any evidence of how you can get this installed in 10mins
Googling for 'gnuwin32 libpng': Five or so seconds. You end up here -- the second hit on the results page, clearly marked LibPng for Windows.
Downloading the libpng developer files (http://gnuwin32.sourceforge.net/downlinks/libpng-lib-zip.php): Less than ten seconds. This link is on the page given above. Then you click the handy "zlib" link at the bottom of the page, conveniently listed as a dependancy of libpng.
Downloading the zlib developer files (http://gnuwin32.sourceforge.net/downlinks/zlib-lib-zip.php): Less than ten seconds. Guess what? There's a zlib.h in there! Gasp and horror! This is from the zlib page.
Unzipping both: Another ten-twenty seconds.
Writing a post about it: Priceless.
All in all this took less than a minute. In summary... if this is taking you more than five minutes maximum to do, it's not because of what's available or not available on the net. It couldn't be any easier, but I guess that doesn't keep people from failing anyway...
you presume that i knew exactly which files to choose out of the many offered.
mind you you didn't choose the "complete" package.
you choose what appears to be "developer" files, over the "complete packages" this is not logical, this to a new visitor would appear to be only getting half of what is required.
now i have another problem.
the zconf.h file is trying to include unistd.h
Hey, it's not my fault that you're incompetent. My point still stands; it's very easy to install libpng, and figuring out that you might need the "developer files" in a situation where you want to develop programs using libpng isn't exactly rocket science.
the zconf.h file is trying to include unistd.h
You didn't download all of the dependencies, now did you? I happen to use MinGW, which comes with this already. Using a non-sane compiler means you have to do a little extra work, but it's still not rocket science.
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 is utter, utter hogwash. I downloaded both the "Complete" packages for kicks, and guess what? The zlib Complete Package does contain zlib.h! In fact, all the required files for each package is contained in the Complete Packages, including all the developer files!
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.
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.
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:
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.
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 |
Compile as C. I'll see about making it C++ compatible some other time (or send a patch).
What's that libgw32c library you're talking about? I've been using loadpng for some time and I've never needed that
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
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:
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.
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!
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.
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.
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.
Search this thread for libgw32c.
i already installed that. (using msvc, incase i need compiler specific tips)
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
-------------------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.
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.
same error
See edit. Sorry about that.
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
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.
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)
bump
it worked! i just don't know how to use it!
Thanks for testing. I think all the information you need is in loadpng.h. Failing that, see the source.
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.)
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...
(zconf.h requiring unistd.h)
Fnghghf. You didn't read all my posts, did you?
You didn't download all of the dependencies, now did you? I happen to use MinGW, which comes with this already. Using a non-sane compiler means you have to do a little extra work, but it's still not rocket science.
The package linked in that post, which is listed as a requirement on the libpng page, has unistd.h in it.
Oscar, as far as my howto is concerned, the whole idea was to get zlib and libpng up and running as quickly as possible. For mingw, the gnuwin32 way is the fastest I know: download and run two installers. I'd hoped that it would be the same for MSVC, but unfortunately the dependency in zconf.h cropped up. With the "#if 0" hack, the process for MSVC is to download and run two installers, and edit one file. That's not too bad, I think.
Using the official zlib DLL would probably be best, but it looks like you would have to unzip and move files around manually. That's quite tedious if you're trying to follow a howto.
well i realised what was wrong with jpegalleg, i never installed libjpeg... if anyone has an msvc binary i'd love it. if not i have to go figure out how to compile it..
edit: nevermind i got pngs working.
i got libpng to compile, and i have libjpg working.
soon as i get libpng working in my app, i'll give you a link to pre-compiled libs.
i got PNG, JPG, and now GIF working.
for MSVC7 (.NET)
anyone want/need binaries/libs/whole folders, msg me.