[SOLVED] Conflict: common/zlib.h , SCUMMVM_LIBS/include

Ask for help with ScummVM problems

Moderator: ScummVM Team

Post Reply
monsieurouxx
Posts: 80
Joined: Fri Oct 19, 2007 5:48 pm

[SOLVED] Conflict: common/zlib.h , SCUMMVM_LIBS/include

Post by monsieurouxx »

When I compile common/unzip.cpp, the compiler does not complain that there is any .h missing, however it fails to recognize the symbols "voidp", "uInt", and a few other custom types.

Where should they be declared? Where do they come from?
In zlib maybe?
Last edited by monsieurouxx on Thu Jan 20, 2011 11:41 am, edited 1 time in total.
User avatar
LordHoto
ScummVM Developer
Posts: 1029
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Re: Cannot compile common/unzip.cpp

Post by LordHoto »

monsieurouxx wrote:When I compile common/unzip.cpp, the compiler does not complain that there is any .h missing, however it fails to recognize the symbols "voidp", "uInt", and a few other custom types.

Where should they be declared? Where do they come from?
In zlib maybe?
In case you have zlib installed they should be defined inside zconf.h (which is included by zlib.h). In case you do not have zlib installed they are defined right inside common/unzip.cpp. Of course in the latter case you might not be able to use the .zip themes anymore.
monsieurouxx
Posts: 80
Joined: Fri Oct 19, 2007 5:48 pm

Re: Cannot compile common/unzip.cpp

Post by monsieurouxx »

LordHoto wrote:
monsieurouxx wrote: In case you have zlib installed they should be defined inside zconf.h (which is included in zlib.h). In case you do not have zlib installed they are defined right inside common/unzip.cpp.
Hmmm, that's weird, because the compiler doesn't use either definitions.
I noticed there is a #if to decide what inclusions to make.
If the relevant compilation variable is not defined automatically by create_project, then I don't know which one(s) it should be...
User avatar
LordHoto
ScummVM Developer
Posts: 1029
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Re: Cannot compile common/unzip.cpp

Post by LordHoto »

monsieurouxx wrote:
LordHoto wrote: In case you have zlib installed they should be defined inside zconf.h (which is included in zlib.h). In case you do not have zlib installed they are defined right inside common/unzip.cpp.
Hmmm, that's weird, because the compiler doesn't use either definitions.
I noticed there is a #if to decide what inclusions to make.
If the relevant compilation variable is not defined automatically by create_project, then I don't know which one(s) it should be...
I think by default create_project sets the ZLIB feature to enabled, thus it should define "USE_ZLIB" and thus the code should include <zlib.h> and thus it should take the definition from zconf.h. You just might want to check that there is a proper uInt typedef in zconf.h.
monsieurouxx
Posts: 80
Joined: Fri Oct 19, 2007 5:48 pm

Re: Cannot compile common/unzip.cpp

Post by monsieurouxx »

LordHoto wrote:"USE_ZLIB"
Super useful tip, thanks.
I'll try it as soon as possible.
User avatar
md5
ScummVM Developer
Posts: 2250
Joined: Thu Nov 03, 2005 9:31 pm
Location: Athens, Greece

Re: Cannot compile common/unzip.cpp

Post by md5 »

monsieurouxx wrote:
LordHoto wrote:"USE_ZLIB"
Super useful tip, thanks.
I'll try it as soon as possible.
create_project should do that for you, theoretically it should set USE_ZLIB on its own by default
monsieurouxx
Posts: 80
Joined: Fri Oct 19, 2007 5:48 pm

Re: Cannot compile common/unzip.cpp

Post by monsieurouxx »

EDIT: see next post
Last edited by monsieurouxx on Thu Jan 20, 2011 10:55 am, edited 1 time in total.
monsieurouxx
Posts: 80
Joined: Fri Oct 19, 2007 5:48 pm

Post by monsieurouxx »

I've found the cause:
There's a conflict between <scummvm>/common/zlib.h and SCUMMVM_LIBS/include/zlib.h

It's caused by the fact that both folders are included in the search path of the compiler by create_project.
Since zlib.h is included with the command #include <zlib.h>, there is an ambiguity -- unproperly resolved by the compiler.

EDIT: It's solved simply by reverting the search directories (that is by moving SCUMMVM_LIBS/include hihgher than ../../common in the list of the IDE )

If it's confirmed, that should be changed in create_project.
I haven't had the opportunity to see if it does it in a MSVC project too. It's the nightly build (obviously, since ScummVM 1.2.1 doesn't use create_project).[/b]
Post Reply