Opened 18 years ago

Closed 18 years ago

Last modified 6 years ago

#3148 closed defect (fixed)

MSVC8: Build errors

Reported by: bluegr Owned by: DrMcCoy
Priority: normal Component: Port: Win32
Version: Keywords: build
Cc: Game:

Description

I get several warnings and some errors with MSVC8 when trying to build ScummVM:

Warnings: Warning 13 warning C4701: potentially uninitialized local variable 'retSize' used c:\projects\scummvm\scummvm\trunk\engines\gob\inter_v1.cpp 2251
Warning 15 warning C4701: potentially uninitialized local variable 'x' used c:\projects\scummvm\scummvm\trunk\engines\gob\util.cpp 129 Warning 16 warning C4701: potentially uninitialized local variable 'y' used c:\projects\scummvm\scummvm\trunk\engines\gob\util.cpp 129 Warning 12 warning C4701: potentially uninitialized local variable 'dataSize' used c:\projects\scummvm\scummvm\trunk\engines\gob\inter_v2.cpp 2089
Warning 13 warning C4701: potentially uninitialized local variable 'retSize' used c:\projects\scummvm\scummvm\trunk\engines\gob\inter_v2.cpp 1880

These are fixed if line 85 of gob/util.cpp is changed from: int16 x, y; to: int16 x = 0; int16 y = 0;

and line 2220 of gob/inter_v1.cpp is changed from: int16 retSize; to: int16 retSize = 0;

and line 1817 of gob/inter_v2.cpp is changed from: int32 retSize; to: int32 retSize = 0;

and line 2020 of gob/inter_v2.cpp is changed from: uint32 dataSize; to: uint32 dataSize = 0;

It also can't find 2 obj files: Error 1 fatal error LNK1181: cannot open input file '.\agi_release\patches.obj' agi Error 2 fatal error LNK1181: cannot open input file '.\lure_release\system.obj' lure

Also, some of the projects have to be updated, as they point to files which are no longer there (removed by some commits):

* In the agi engine, file patches.cpp no longer exists * In the gob engine, files anim.h, anim.cpp, pack.h, pack.cpp, timer.h, timer.cpp no longer exist * In the lure engine, files system.h and system.cpp no longer exist

And it throws several warnings, which are treated as errors and the project refuses to be built (I've set

Error 3 error C2220: warning treated as error - no 'object' file generated c:\projects\scummvm\scummvm\trunk\engines\gob\inter_v2.cpp 2006
Warning 4 warning C4800: 'uint32' : forcing value to bool 'true' or 'false' (performance warning) c:\projects\scummvm\scummvm\trunk\engines\gob\inter_v2.cpp 2006
Warning 5 warning C4800: 'uint32' : forcing value to bool 'true' or 'false' (performance warning) c:\projects\scummvm\scummvm\trunk\engines\gob\inter_v2.cpp 2007
Warning 6 warning C4800: 'uint32' : forcing value to bool 'true' or 'false' (performance warning) c:\projects\scummvm\scummvm\trunk\engines\gob\inter_v2.cpp 2010
Warning 7 warning C4800: 'uint32' : forcing value to bool 'true' or 'false' (performance warning) c:\projects\scummvm\scummvm\trunk\engines\gob\inter_v2.cpp 2011
Error 8 error C2220: warning treated as error - no 'object' file generated c:\projects\scummvm\scummvm\trunk\engines\gob\game.cpp 136 Warning 9 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) c:\projects\scummvm\scummvm\trunk\engines\gob\game.cpp 136 Error 10 error C2220: warning treated as error - no 'object' file generated c:\projects\scummvm\scummvm\trunk\engines\gob\draw_v2.cpp 561 Warning 11 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) c:\projects\scummvm\scummvm\trunk\engines\gob\draw_v2.cpp 561 Error 12 error C2220: warning treated as error - no 'object' file generated c:\projects\scummvm\scummvm\trunk\engines\scumm\sound.cpp 1224
Warning 13 warning C4245: '=' : conversion from '' to 'uint32', signed/unsigned mismatch c:\projects\scummvm\scummvm\trunk\engines\scumm\sound.cpp 1224
Warning 14 warning C4245: '=' : conversion from '' to 'uint32', signed/unsigned mismatch c:\projects\scummvm\scummvm\trunk\engines\scumm\sound.cpp 1248
Warning 15 warning C4245: '=' : conversion from '' to 'uint32', signed/unsigned mismatch c:\projects\scummvm\scummvm\trunk\engines\scumm\sound.cpp 2110
Error 16 error C2220: warning treated as error - no 'object' file generated c:\projects\scummvm\scummvm\trunk\engines\scumm\resource_v3.cpp 57
Warning 17 warning C4245: '=' : conversion from '' to 'uint32', signed/unsigned mismatch c:\projects\scummvm\scummvm\trunk\engines\scumm\resource_v3.cpp 57
Error 18 error C2220: warning treated as error - no 'object' file generated c:\projects\scummvm\scummvm\trunk\engines\scumm\resource_v2.cpp 96
Warning 19 warning C4245: '=' : conversion from '' to 'uint32', signed/unsigned mismatch c:\projects\scummvm\scummvm\trunk\engines\scumm\resource_v2.cpp 96
Warning 20 warning C4245: '=' : conversion from '' to 'uint32', signed/unsigned mismatch c:\projects\scummvm\scummvm\trunk\engines\scumm\resource_v2.cpp 105 Warning 21 warning C4245: '=' : conversion from '' to 'uint32', signed/unsigned mismatch c:\projects\scummvm\scummvm\trunk\engines\scumm\resource_v2.cpp 114 Warning 22 warning C4245: '=' : conversion from '' to 'uint32', signed/unsigned mismatch c:\projects\scummvm\scummvm\trunk\engines\scumm\resource_v2.cpp 123

In particular, it doesn't like some (not all of) the RES_INVALID_OFFSET constants and some of the bool casts in the gob engine

I'm not sure how to fix those warnings, and since "Treat warnings as errors" is set to "Yes" (under configuration properties->C/C++->General), the project fails to compile. I've tried setting this to "No", and then VC8 continues, but then it throws 17 unresolved externals:

Error 15 error LNK2001: unresolved external symbol "public: __thiscall DefaultEventManager::DefaultEventManager(class OSystem *)" (??0DefaultEventManager@@QAE@PAVOSystem@@@Z) system.obj
Error 16 error LNK2001: unresolved external symbol "bool __cdecl Audio::loadAIFFFromStream(class Common::SeekableReadStream &,int &,int &,unsigned char &)" (?loadAIFFFromStream@Audio@@YA_NAAVSeekableReadStream@Common@@AAH1AAE@Z) sword1.lib
Error 17 error LNK2001: unresolved external symbol "public: __thiscall Gob::SaveLoad_v3::SaveLoad_v3(class Gob::GobEngine *,char const *)" (??0SaveLoad_v3@Gob@@QAE@PAVGobEngine@1@PBD@Z) gob.lib Error 18 error LNK2001: unresolved external symbol "public: __thiscall Gob::Goblin_v3::Goblin_v3(class Gob::GobEngine *)" (??0Goblin_v3@Gob@@QAE@PAVGobEngine@1@@Z) gob.lib Error 19 error LNK2001: unresolved external symbol "public: __thiscall Gob::Inter_v3::Inter_v3(class Gob::GobEngine *)" (??0Inter_v3@Gob@@QAE@PAVGobEngine@1@@Z) gob.lib Error 20 error LNK2001: unresolved external symbol "public: __thiscall Gob::SaveLoad_v2::SaveLoad_v2(class Gob::GobEngine *,char const *)" (??0SaveLoad_v2@Gob@@QAE@PAVGobEngine@1@PBD@Z) gob.lib Error 21 error LNK2001: unresolved external symbol "public: __thiscall Gob::ImdPlayer::ImdPlayer(class Gob::GobEngine *)" (??0ImdPlayer@Gob@@QAE@PAVGobEngine@1@@Z) gob.lib Error 22 error LNK2001: unresolved external symbol "public: void __thiscall Gob::ImdPlayer::play(char const *,short,short,bool)" (?play@ImdPlayer@Gob@@QAEXPBDFF_N@Z) gob.lib Error 23 error LNK2001: unresolved external symbol "public: void __thiscall Gob::ImdPlayer::play(char const *,short,short,short,short,bool,bool)" (?play@ImdPlayer@Gob@@QAEXPBDFFFF_N1@Z) gob.lib Error 24 error LNK2001: unresolved external symbol "public: void __thiscall Gob::ImdPlayer::closeImd(void)" (?closeImd@ImdPlayer@Gob@@QAEXXZ) gob.lib Error 25 error LNK2001: unresolved external symbol "public: void __thiscall Gob::ImdPlayer::closeImd(void)" (?closeImd@ImdPlayer@Gob@@QAEXXZ) gob.lib Error 26 error LNK2001: unresolved external symbol "public: void __thiscall Gob::ImdPlayer::closeImd(void)" (?closeImd@ImdPlayer@Gob@@QAEXXZ) gob.lib Error 27 error LNK2001: unresolved external symbol "public: void __thiscall Gob::ImdPlayer::play(short,unsigned short,short,short,short,short)" (?play@ImdPlayer@Gob@@QAEXFGFFFF@Z) gob.lib Error 28 error LNK2001: unresolved external symbol "public: void __thiscall Gob::ImdPlayer::play(short,unsigned short,short,short,short,short)" (?play@ImdPlayer@Gob@@QAEXFGFFFF@Z) gob.lib Error 29 error LNK2001: unresolved external symbol "public: signed char __thiscall Gob::ImdPlayer::openImd(char const *,short,short,short,short)" (?openImd@ImdPlayer@Gob@@QAECPBDFFFF@Z) gob.lib Error 30 error LNK2001: unresolved external symbol "public: signed char __thiscall Gob::ImdPlayer::openImd(char const *,short,short,short,short)" (?openImd@ImdPlayer@Gob@@QAECPBDFFFF@Z) gob.lib Error 31 error LNK2001: unresolved external symbol "public: void __thiscall Gob::ImdPlayer::finishImd(struct Gob::ImdPlayer::Imd * &)" (?finishImd@ImdPlayer@Gob@@QAEXAAPAUImd@12@@Z) gob.lib Error 32 error LNK2001: unresolved external symbol "public: struct Gob::ImdPlayer::Imd * __thiscall Gob::ImdPlayer::loadImdFile(char const *,class Gob::SurfaceDesc *,signed char)" (?loadImdFile@ImdPlayer@Gob@@QAEPAUImd@12@PBDPAVSurfaceDesc@2@C@Z) gob.lib Error 33 error LNK2001: unresolved external symbol "public: long __thiscall Gob::SaveLoad::getSize(enum Gob::SaveType)" (?getSize@SaveLoad@Gob@@QAEJW4SaveType@2@@Z) gob.lib Error 34 error LNK2001: unresolved external symbol "public: bool __thiscall Gob::SaveLoad::load(enum Gob::SaveType,short,long,long)" (?load@SaveLoad@Gob@@QAE_NW4SaveType@2@FJJ@Z) gob.lib Error 35 error LNK2001: unresolved external symbol "public: bool __thiscall Gob::SaveLoad::save(enum Gob::SaveType,short,long,long)" (?save@SaveLoad@Gob@@QAE_NW4SaveType@2@FJJ@Z) gob.lib

I got no clue on how to fix those, so I can't build the solution

Ticket imported from: #1700986. Ticket imported from: bugs/3148.

Attachments (4)

gob-vc80-warnings.diff (1.8 KB ) - added by bluegr 18 years ago.
Fix for some of the VC80 warnings in the gob engine
msvc8_fixes.patch (3.5 KB ) - added by bluegr 18 years ago.
Fixes for the MSVC8 project files, to reflect some of the latest changes made to the engines
msvc8_fixes_part2.patch (831 bytes ) - added by bluegr 18 years ago.
Fixes for the MSVC8 project files, part 2: some more missing files
msvc8-aiff-patch.patch (647 bytes ) - added by bluegr 18 years ago.
Fixes to aiff.cpp, to prevent some remaining warnings from MSVC8

Download all attachments as: .zip

Change History (18)

comment:1 by bluegr, 18 years ago

The 2 obj files which it can't find are caused by the missing files. If those are removed from their respective solutions, this error is fixed

comment:2 by DrMcCoy, 18 years ago

The reason for unresolved symbols in the GobEngine is that some new files that have to be build and linked as well. These are saveload.cpp, saveload_v2.cpp, saveload_v3.cpp and imd.cpp. Seems like nobody updated the VC8 project files.

Don't know about the bool casts. They are explicit, that should tell the compiler to shut up and see that this is exactly what we want there...

by bluegr, 18 years ago

Attachment: gob-vc80-warnings.diff added

Fix for some of the VC80 warnings in the gob engine

comment:3 by bluegr, 18 years ago

Thanks drmccoy, that was the problem Apart from the files already mentioned, goblin_v3.cpp and inter_v3.cpp are also needed

Some more fixes for MSVC8 warnings:

In gob/imd.cpp, change line 964 from: uint32 framePos; to: uint32 framePos = 0;

In gob/inter_v3.cpp, change line 718 from: int16 collId, collCmd; to: int16 collId = 0, collCmd;

Attaching a patch that silences some of the gob engine warnings The "performance warnings" are still there, though File Added: gob-vc80-warnings.diff

comment:4 by DrMcCoy, 18 years ago

Thanks, commited the changes

comment:5 by bluegr, 18 years ago

OK now I ended up with 2 unresolved externals: Error 1 error LNK2001: unresolved external symbol "public: __thiscall DefaultEventManager::DefaultEventManager(class OSystem *)" (??0DefaultEventManager@@QAE@PAVOSystem@@@Z) system.obj
Error 2 error LNK2001: unresolved external symbol "bool __cdecl Audio::loadAIFFFromStream(class Common::SeekableReadStream &,int &,int &,unsigned char &)" (?loadAIFFFromStream@Audio@@YA_NAAVSeekableReadStream@Common@@AAH1AAE@Z) sword1.lib

The second one seems to be related with the latest AIFF stream commits to the sword engine... although no files have been changed. Am I missing a build flag here?

comment:6 by DrMcCoy, 18 years ago

Audio::loadAIFFFromStream() is in sound/aiff.cpp and the DefaultEventManager is in backends/events/default/default-events.cpp, maybe the project file is missing them, too.

by bluegr, 18 years ago

Attachment: msvc8_fixes.patch added

Fixes for the MSVC8 project files, to reflect some of the latest changes made to the engines

comment:7 by bluegr, 18 years ago

Here's a patch that updated the MSVC8 project files

I've updated the lists for the files in the solutions, set "Treat warnings as errors" to "No" for the gob and scumm engines (because MSVC8 throws warnings in those two engines) and also set subsystem to "Console" under Linker->System, in order to show the console, according to this: http://www.libsdl.org/cgi/docwiki.cgi/FAQ_20Console

I'm not sure if the last change is correct, however the console is not displayed in the resulting executable, and I thought this was the reason for that

I still get the aforementioned unresolved externals, though File Added: msvc8_fixes.patch

by bluegr, 18 years ago

Attachment: msvc8_fixes_part2.patch added

Fixes for the MSVC8 project files, part 2: some more missing files

comment:8 by bluegr, 18 years ago

Yes that was it, thanks again :) Have to look through the solution more carefully next time :P

Attaching a patch that includes those files in the solution as well

I now still have 1 unresolved external, which is a strange one: Error 15 error LNK2001: unresolved external symbol _main LIBCMT.lib

The full error from BuildLog.htm is: LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

I couldn't find a file named crt* or cmt* or libcmt* in the solution, so I'm not sure what this one refers to :( File Added: msvc8_fixes_part2.patch

comment:9 by bluegr, 18 years ago

OK this unresolved external is not associated with ScummVM itself. According to this: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1467745&SiteID=1 some of the default libraries have to be inserted in the "ignore" field (which, apparently, ignores warnings associated with them)

I went to Configuration Properties->Linker->Input and changed the libraries in "Ignore specific library" from: libc.lib to: libcmtd.lib;libcmt.lib;libc.lib;libcd.lib

Which, apparently, fixed the error. I've uploaded (yet another) patch with this change

The latest changes in gob/sound.cpp broke MSVC8 (revision #26493), which now throws the following errors and warnings: Error 1 error C2782: 'T MAX(T,T)' : template parameter 'T' is ambiguous c:\projects\scummvm\scummvm\trunk\engines\gob\sound.cpp 238 Error 2 error C2782: 'T MAX(T,T)' : template parameter 'T' is ambiguous c:\projects\scummvm\scummvm\trunk\engines\gob\sound.cpp 344 Warning 3 warning C4554: '<<' : check operator precedence for possible error; use parentheses to clarify precedence c:\projects\scummvm\scummvm\trunk\engines\gob\sound.cpp 408

File Added: msvc8_fixes_part3.patch

by bluegr, 18 years ago

Attachment: msvc8-aiff-patch.patch added

Fixes to aiff.cpp, to prevent some remaining warnings from MSVC8

comment:10 by bluegr, 18 years ago

Deleting my last upload, since aquadran's latest commit fixed MSVC8 now :) Thanks

Since MSVC8 still complains about sound/aiff.cpp, here's a small patch to remove those remaining warnings.

Please close this, with aquadran's fixes (and, optionally, my small patch on aiff.cpp) ScummVM compiles fine now under MSVC8 :) File Added: msvc8-aiff-patch.patch

comment:11 by DrMcCoy, 18 years ago

Okay, commited these changes as well. Closing it now, thanks.

comment:12 by DrMcCoy, 18 years ago

Resolution: fixed
Status: newclosed

comment:13 by Kirben, 15 years ago

Component: --Unset--
Keywords: build added
Owner: set to DrMcCoy

comment:14 by digitall, 6 years ago

Component: --Unset--Port: Win32
Note: See TracTickets for help on using tickets.