BUG/BULL/BBAI? source code error

Jester Fool

Emperor
Joined
Apr 2, 2010
Messages
1,181
Location
Katy, TX
Specifics: Vista 64 bit OS; Visual Studio 2008 Express; have successfully compiled the vanilla SDK and other Mods
I am trying to compile a SDK which uses BUG DLL makefile. I can compile it using the 2003 C++ Toolkit fine but I get CTD running the Debug DLL. I then switched to the tools that come with VS 2008 to make the Debug DLL. I have fixed the errors revealed so far (most of which were undeclared identifiers in For loops) but get these errors...
Spoiler :
CxImage/general/ximatran.cpp(183) : error C2666: 'div' : 2 overloads have similar conversions
1> C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/include\stdlib.h(480): could be 'ldiv_t div(long,long)'
1> C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/include\stdlib.h(446): or 'div_t div(int,int)'
1> while trying to match the argument list '(long, int)'
1>CxImage/general/ximatran.cpp(301) : error C2666: 'div' : 2 overloads have similar conversions
1> C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/include\stdlib.h(480): could be 'ldiv_t div(long,long)'
1> C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/include\stdlib.h(446): or 'div_t div(int,int)'
1> while trying to match the argument list '(long, int)'
Looking at the source
Code:
div_r = div(y + dlineup, 8);
the problem is clear since both y and dlineup have already been declared long and obviously 8 is an integer. How do you force a conversion? Any help would be appreciated.
 
I then switched to the tools that come with VS 2008 to make the Debug DLL.

This approach is not going to work. The civ code was written in 2001-2002 and it is completely incompatible with more recent compilers. You will have to make hundreds of code changes in order to do a native VS 2008 compile.

What is the specific problem that happens with your VS 2003 debug dll? Are you able to attach the debugger? Are you able to start a game?
 
I get an XML error...
Spoiler :
There are more siblings than memory allocated for them in CvXMLLoadUtility::SetVariableListTagPair
Current XML file is: xml\Civilizations/Civ4LeaderHeadInfos.xml
followed by...
Spoiler :
Unhandled exception at 0x7729ac6c in Civ4BeyondSword.exe:0xC0000005:Access violation writing location 0x00007364
and of course the dreaded CTD. I actually could compile, natively under VS 2008, if I removed ximage (with a bunch of warnings) but of course couldn't link any of the OBJ files since removing ximage created unresolved external references. I don't know if ximage is causing the CTD but from what I can tell, the addition of ximage into BUG is the only change from the old code.
 
I don't think the xml error is due to the way you built the dll.

When you build in "final release" and "debug" you should get the same xml error. Is that correct? Once you get this xml error all bets are off and a crash is highly likely. When you change only to use the dll which is distributed in the release, then you do not get any xml error. Is that also correct?

Then the source code you are building from must not be the same as what was built to make dll in the release. If that is the problem, we should go back to the DW sub-forum and discuss there.
 
No. I only get the XML using the debug DLL. The Final_Release and original DLLs work.
 
Uh... that happens when you create an array of size -1 or 0...
 
Are you using the original BTS XML files, or are they modded as well?
Unfortunately they are modded as well (and parts of other mods are embedded in the source code as well). I'll try compiling a debug dll with just BUG/BULL. If that works at least I will know the problem is not caused by BUG/BULL.
 
Back
Top Bottom