Opened 13 years ago

Closed 13 years ago

Last modified 10 months ago

#3021 closed defect (fixed)

MSVC71 BUILD: Latest SVN doesn't compile

Reported by: SF/josemuk Owned by: lordhoto
Priority: normal Component: Port: Win32
Keywords: Cc:
Game:

Description

Compiling with Microsoft Visual Studio 2003 I get a lot of errors like this with different engines (saga, agi, cine, kyra, agos, etc):

sagagame.cpp(576) : error C2073: 'Common::ADGameDescription::filesDescriptions' : elements of partially initialized array must have a default constructor

sagagame.cpp(576) : error C2512: 'Common::ADGameFileDescription' : no appropriate default constructor available

agosgame.cpp(12) : error C2073: 'Common::ADGameDescription::filesDescriptions' : elements of partially initialized array must have a default constructor

agosgame.cpp(12) : error C2512: 'Common::ADGameFileDescription' : no appropriate default constructor available

I suppose is due to the changes added recently to the game detector engine (3 days ago compiled fine)

Ticket imported from: #1645653. Ticket imported from: bugs/3021.

Attachments (1)

advdetector_no_const.diff (1.2 KB) - added by cyxx 13 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 13 years ago by fingolfin

Owner: set to sev-

comment:2 Changed 13 years ago by lordhoto

From what I understand the problem is that we initialize in most (maybe all?) cases less than 14 entries of ADGameDescription::filesDescriptions, now we need an default constructor for this, but if we add one braced initializing would be broken (at least for gcc), a possible fix would be something like I did here:
http://svn.sourceforge.net/viewvc/scummvm?view=rev&revision=23518 (even though that was because of another reason, iirc). I don't know if that's something we want, since we use everywhere braced initializers for arrays.

Changed 13 years ago by cyxx

Attachment: advdetector_no_const.diff added

comment:3 Changed 13 years ago by cyxx

Not sure about other compilers, but under gcc3, I get warnings in that part of code too.

Johannes, your solution seems good. But let me suggest another one : maybe simply remove the const qualifiers in ADGameFileDescription, ADGameDescription as the attached patch does. Since the detection data structures in the engines are always declared with the "const" keyword (gameDescriptions, detectionParams, it seems redundant to have them here too.

File Added: advdetector_no_const.diff

comment:4 Changed 13 years ago by SF/josemuk

With cyx's patch, compiling with Visual Studio is working again. Many thanks!

comment:5 Changed 13 years ago by lordhoto

Yeah Gregory's solution is much simpler and since, as he stated, we use const
in the detection structures it shouldn't hurt.

comment:6 Changed 13 years ago by lordhoto

Owner: changed from sev- to lordhoto
Resolution: fixed
Status: newclosed

comment:7 Changed 13 years ago by lordhoto

I committed Gregory's patch now, if anybody has any objections it should be easy to revert.

I'm also assign it to myself since I committed it (I hope that's alright...)

comment:8 Changed 10 months ago by digitall

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