Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : Development : Compiling the source: Stuck at the linking stage
New Topic New Poll Post Reply
Poster Message
Hammerite
Level: Delver
Rank Points: 44
Registered: 07-13-2005
IP: Logged
icon Compiling the source: Stuck at the linking stage (0)  
I've been following silver's (admirably thorough) guide to getting DROD:TCB to compile on Windows. It's been challenging so far but I'm at the stage where project "drod" needs to be linked. ("DRODlib", "FrontEndLib" and "BackEndLib" have all been successfully built.) Unfortunately, it seems like there are a lot of files that are not talking to each other, because when it tries to do the linking, MSVC reports about 3000 linking errors, all LNK2001 or LNK2019 ("unresolved external symbol"). So somehow, the different files that have been compiled don't seem to have any knowledge of one another's functions or variables. Can anyone suggest what I might have done wrong? silver doesn't seem to have encountered any problems getting DROD to link, because he doesn't mention it. I am using the latest version of the source (unless mrimer has put up a new version since yesterday evening).
01-27-2010 at 07:41 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5463
Registered: 02-04-2003
IP: Logged
icon Re: Compiling the source: Stuck at the linking stage (0)  
Hammerite wrote:
I've been following silver's (admirably thorough) guide to getting DROD:TCB to compile on Windows. It's been challenging so far but I'm at the stage where project "drod" needs to be linked. ("DRODlib", "FrontEndLib" and "BackEndLib" have all been successfully built.) Unfortunately, it seems like there are a lot of files that are not talking to each other, because when it tries to do the linking, MSVC reports about 3000 linking errors, all LNK2001 or LNK2019 ("unresolved external symbol"). So somehow, the different files that have been compiled don't seem to have any knowledge of one another's functions or variables. Can anyone suggest what I might have done wrong? silver doesn't seem to have encountered any problems getting DROD to link, because he doesn't mention it. I am using the latest version of the source (unless mrimer has put up a new version since yesterday evening).
Hey, great progress so far!

Hmm... can you see that the DROD project has the other three libs checked as dependencies in MSVC?

Also, just to make sure we're looking at the right place for a problem...do the errors refer to functions in the DROD library modules, or to some of the other third-party libs?

[Last edited by mrimer at 01-27-2010 11:39 PM]
01-27-2010 at 11:38 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
Hammerite
Level: Delver
Rank Points: 44
Registered: 07-13-2005
IP: Logged
icon Re: Compiling the source: Stuck at the linking stage (+2)  
mrimer wrote:
Hey, great progress so far!

Hmm... can you see that the DROD project has the other three libs checked as dependencies in MSVC?

Also, just to make sure we're looking at the right place for a problem...do the errors refer to functions in the DROD library modules, or to some of the other third-party libs?
Thanks for the tip, there were no dependencies set up. I knew it would be something simple that I had missed.

DROD now compiles. I renamed the DROD executable in my TCB installation, to back it up, and c&p'ed in the debug version I'd compiled; it runs, although slowly (which I believe is expected).

However, I can't get DRODUtil to compile. Am I correct in thinking that in order to get new lines of text into the game, I need to get DRODUtil to compile? I have added new MIDs in Texts/EditScreens.uni and appropriate references everywhere it seems to be necessary, but my objects have a blank line as description in the editor and in-game.

DRODUtil has DRODLib, FrontEndLib and BackEndLib set as dependencies, but when compiled gives these three linking errors:

backendlib.lib(Assert.obj) : error LNK2005: "void __cdecl AssertErr(char const *,int,char const *)" (?AssertErr@@YAXPBDH0@Z) already defined in Assert.obj

RoomWidget.obj : error LNK2019: unresolved external symbol "public: void __thiscall CVarMonitorEffect::SetText(wchar_t const *)" (?SetText@CVarMonitorEffect@@QAEXPB_W@Z) referenced in function "protected: void __thiscall CRoomWidget::ShowVarUpdates(bool)" (?ShowVarUpdates@CRoomWidget@@IAEX_N@Z)

RoomWidget.obj : error LNK2019: unresolved external symbol "public: __thiscall CVarMonitorEffect::CVarMonitorEffect(class CWidget *)" (??0CVarMonitorEffect@@QAE@PAVCWidget@@@Z) referenced in function "protected: void __thiscall CRoomWidget::ShowVarUpdates(bool)" (?ShowVarUpdates@CRoomWidget@@IAEX_N@Z)[\quote]

EDIT: I got rid of the two "unresolved external symbol" errors by adding VarMomitorEffect.cpp to project DRODUtil. I just have the one "already defined" linking error left now.

[Last edited by Hammerite at 01-28-2010 03:25 PM]
01-28-2010 at 02:38 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Hammerite
Level: Delver
Rank Points: 44
Registered: 07-13-2005
IP: Logged
icon Re: Compiling the source: Stuck at the linking stage (0)  
That's rather strange. I went back to re-edit my post as it looked like I'd typed my edit inside the quote environment, but the "quote" end-tag is indeed in the correct place.
01-28-2010 at 03:27 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Hammerite
Level: Delver
Rank Points: 44
Registered: 07-13-2005
IP: Logged
icon Re: Compiling the source: Stuck at the linking stage (+1)  
Fixed the remaining error by removing assert.cpp from DRODUtil. DRODUtil now links. Still don't have added text though, even after linking DRODUtil and DROD in succession. That's quite minor though. DROD compiles, so I can start playing.
01-28-2010 at 03:39 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Hammerite
Level: Delver
Rank Points: 44
Registered: 07-13-2005
IP: Logged
icon Re: Compiling the source: Stuck at the linking stage (+1)  
I've played around with the source for a little while (mostly just finding various ways to make the game crash), but after a while I got to the point where any time I made a move in a game it crashed to the desktop with the following dialog:

Microsoft Visual C++ Debug Library
===================================

Debug Assertion Failed!

Program: D:\Programs\drod-city\drod.exe
File: d:\programs\msvisualstudio9\vc\include\algorithm
Line: 2015

Expression: invalid operator<

For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)

(Abort) (Retry) (Ignore)

So I thought I must have changed something fundamental without realising it. So I deleted the modified source directory and made a new copy of the unaltered source directory, and spent five minutes getting it to a compilable state again. (Then made a copy of it in that state.) But the same error message appears whenever I run drod using the compiled "debug" .exe file. This is odd, because it didn't happen at all the previous time around, not until I'd been abusing it for a good couple of hours.
01-28-2010 at 08:35 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5463
Registered: 02-04-2003
IP: Logged
icon Re: Compiling the source: Stuck at the linking stage (0)  
Hammerite wrote:
Fixed the remaining error by removing assert.cpp from DRODUtil. DRODUtil now links. Still don't have added text though, even after linking DRODUtil and DROD in succession. That's quite minor though. DROD compiles, so I can start playing.
Great progress, Hammerite!

What you need to do in order to add new texts into the main .dat file is to run your built DRODUtil from the command line with the following parameters (iirc):

drodutil delete
drodutil create
drodutil import

The first one will delete your drod3_0.dat file. You can perform this step on your own, of course -- it can be used in conjunction with an automated process (e.g. batch file or bash script), if you want to set one up. The next rebuilds an empty .dat file. The third command option imports all the text MIDs listed in the .uni files into the .dat file. Also, with this command, a new DRODLib/TextMessages.h will be auto-generated, so you can now rebuild DROD, adding the new MID constants into the code. You might also need to specify "-t <path>" for the import step -- I can't recall off the top of my head.

Note that this procedure will give you a bare-bones .dat file -- you can't use it to augment the ones that come pre-built with the demo or registered versions of the game that already have game media embedded in them.

[Last edited by mrimer at 01-29-2010 08:31 PM]
01-29-2010 at 08:31 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5463
Registered: 02-04-2003
IP: Logged
icon Re: Compiling the source: Stuck at the linking stage (0)  
Hammerite wrote:
I've played around with the source for a little while (mostly just finding various ways to make the game crash), but after a while I got to the point where any time I made a move in a game it crashed to the desktop with the following dialog:

Microsoft Visual C++ Debug Library
===================================

Debug Assertion Failed!

Program: D:\Programs\drod-city\drod.exe
File: d:\programs\msvisualstudio9\vc\include\algorithm
Line: 2015

Expression: invalid operator<

For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)

(Abort) (Retry) (Ignore)

So I thought I must have changed something fundamental without realising it. So I deleted the modified source directory and made a new copy of the unaltered source directory, and spent five minutes getting it to a compilable state again. (Then made a copy of it in that state.) But the same error message appears whenever I run drod using the compiled "debug" .exe file. This is odd, because it didn't happen at all the previous time around, not until I'd been abusing it for a good couple of hours.
I think this has to do with how MSVS 2005/2008 have issues with our pathmapping search algorithm's sort routine (see here). It has always had issues in debug mode, and changing it would break existing game path-finding behavior. I believe these errors can be disabled with a compiler flag specified in the project build options, but I can't find the name of that flag atm. I think you can see it if you look at the stl code where the assertion is occurring.
01-29-2010 at 09:55 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
coppro
Level: Smitemaster
Rank Points: 1309
Registered: 11-24-2005
IP: Logged
icon Re: Compiling the source: Stuck at the linking stage (+1)  
Pokes in

Based on that KB page, my first guess is to try linking against the non-debugging version of the standard libraries.

Pokes out.
02-13-2010 at 07:37 AM
View Profile Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : Development : Compiling the source: Stuck at the linking stage
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.9
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.