A simple guide to compiling the DLL

hi again asaf,

past the merging of mod commander i got the warning 4108 (signed/unsigned mismatch). but the mod function properly. so i've continued to merge the mods in which i'm interested with mine.

but now merging the last mod i saw i doesn't function merged but function properly as standalone mod.

i tried many times to recompile/re-merge the c++ source with mine but the result is the same.

so i've thought it can be dued to the signed/unsigned mismatch warning (warning 4108). i've read it can bring some bug.

if i upload my source files can you check them for me (would be great).

or how can i address it ? is there a sw who can check the source file and tell me how address it? i've guessed it can be dued to a variable not signed but i don't know how to sign it and where.

thx
 
hi again asaf,

past the merging of mod commander i got the warning 4108 (signed/unsigned mismatch). but the mod function properly. so i've continued to merge the mods in which i'm interested with mine.

but now merging the last mod i saw i doesn't function merged but function properly as standalone mod.

i tried many times to recompile/re-merge the c++ source with mine but the result is the same.

so i've thought it can be dued to the signed/unsigned mismatch warning (warning 4108). i've read it can bring some bug.

if i upload my source files can you check them for me (would be great).

or how can i address it ? is there a sw who can check the source file and tell me how address it? i've guessed it can be dued to a variable not signed but i don't know how to sign it and where.

thx
The most common source of signed/unsigned mismatch is STL vecor size method which returns an unsigned int but you often compare it to an int. Simply place (int) before the call to the size method.
 
Also note that this warning is problematic if the value of the int (a.k.a signed int) variable can be negative, or if the unsigned int can be very large (more than 2^31). In the common example AIAndy showed, size() usually does not (and in Civ4 case - never) return that large a value, so it's fine.

You can upload the files but I'm not sure I can take a look at it soon. Might be a while. But maybe someone else will be able to take a look at it.
 
how can i sign a variable? my trouble is in CVunit.cpp, cvplayer.cpp, i ask to learn how fix it.

so i upload the 2 .cpp file involved. if someone can check these i can compare with winmerge, see what is added and learn how to fix. please someone fix these. inside the .rar there is the output in a text file where is stated the line invlolved.

thnx
 

Attachments

  • source files.zip
    153.8 KB · Views: 150
The warning has nothing to do with your problem. Both lines are just comparing size() with an int.

What exactly is the problem you're facing?
 
my problem is that the mods i'm merging actually seem to not work even if they works as standalone mod. i don't know what to do . i've tried to re-merge the source files but the results is the same. the mercenaries mod also stopped working.
 
So it compiles fine, but some of the functionality has stopped working?

That requires debugging, which in turn requires you to understand what the code *ought* to do before you can see how to fix that.
Unfortunately, I don't have the time to help you with that.

To technically learn how to debug, see the second part of this tutorial.
To actually do it, you'll probably need to invest some time and see that you really understand what's not working. (note: not *why*. That's what the debugging is for.)
 
this can be a problem. you see i didn't succeded to compile in windows 7 so i've created a VM with XP where i run successfully VS and where i've copied the relevant directory of Civ 4. a little cheating but effective.
But the game doesn't run in xp. so i cannot debug with VS successfully because i can't run the game.

can someone do it for me if i'll upload my entire source dir ?

p.s. a mod merged successfully (mercenaries mod, i've verified that it was working trying to recall mercenaries) has stopped working. but past this mod i've merged also event with images, lead from behind advanced combat odd and other 2 i don't remember.
 
How about we try solving it so you can compile an debug on Windows 7?
What did you try and what were the results?
 
First of all, thanks for the nice tutorial very much.

Now, I'm trying to merge Dale's Combat Mod 319 (DCM319) and Super Fort Mod.
I had finished merging the source codes and now I'm trying to create CvGameCore.dll following your direction.
Seems it works but I saw error message and couldn't find DLL file in release folder..

I guess the problems are here and I cannot figure what's wrong..

The error message part-1

1>CvGameTextMgr.cpp
1>CvGameTextMgr.cpp(2351) : error C2001: newline in constant
1>CvGameTextMgr.cpp(2352) : error C2143: syntax error : missing ')' before 'for'
1>CvGameTextMgr.cpp(2352) : warning C4552: '<' : operator has no effect; expected operator with side-effect
1>CvGameTextMgr.cpp(2352) : error C2143: syntax error : missing ';' before ')'
1>CvGameTextMgr.cpp(2352) : error C2143: syntax error : missing ';' before ')'
[/QUOTE][/SPOILER][/QUOTE]
.
.
.
The error message part-2

1>NMAKE : warning U4011: 'Release\CvGameCoreDLL.dll' : not all dependents available; target not built
1>NMAKE : warning U4011: 'Release' : not all dependents available; target not built
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://d:\CIV\NEW MOD\projectfiles\cvgamecoredll_project\CvGameCoreDLL\Release\BuildLog.htm"
1>CvGameCoreDLL - 5 error(s), 4 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Error message part-1 is kinda weired because it's from orginal code in cvgametext.cpp.
It's below..

// DO NOT REMOVE - needed for font testing - Moose
void createTestFontString(CvWStringBuffer& szString)
{
int iI;
szString.assign(L"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[?^_`abcdefghijklmnopqrstuvwxyz\n");
szString.append(L"{}~\\&#20687;&#51340;&#52432;&#53484;&#54589;&#57385;&#30422;&#35493;&#22283;&#21931;&#25095;&#20486;&#22969;&#33162;&#35206;?&#21959;&#39137;&#23480;&#33222;&#38928;&#38533;&#33210;&#63994;&#31357;&#22686;&#24425;&#20805;&#22338;&#27782;&#27194;&#35440;&#63735;&#50640;&#12475;&#52959;&#46665;&#49804;&#50707;&#359;&#8364;&#65282;&#48462;&#48223;?);
for (iI=0;iI<NUM_YIELD_TYPES;++iI)
szString.append(CvWString::format(L"%c", GC.getYieldInfo((YieldTypes) iI).getChar()));

szString.append(L"\n");
for (iI=0;iI<NUM_COMMERCE_TYPES;++iI)
szString.append(CvWString::format(L"%c", GC.getCommerceInfo((CommerceTypes) iI).getChar()));
szString.append(L"\n");
for (iI = 0; iI < GC.getNumReligionInfos(); ++iI)
{
szString.append(CvWString::format(L"%c", GC.getReligionInfo((ReligionTypes) iI).getChar()));
szString.append(CvWString::format(L"%c", GC.getReligionInfo((ReligionTypes) iI).getHolyCityChar()));
}
for (iI = 0; iI < GC.getNumCorporationInfos(); ++iI)
{
szString.append(CvWString::format(L"%c", GC.getCorporationInfo((CorporationTypes) iI).getChar()));
szString.append(CvWString::format(L"%c", GC.getCorporationInfo((CorporationTypes) iI).getHeadquarterChar()));
}
szString.append(L"\n");
for (iI = 0; iI < GC.getNumBonusInfos(); ++iI)
szString.append(CvWString::format(L"%c", GC.getBonusInfo((BonusTypes) iI).getChar()));
for (iI=0; iI<MAX_NUM_SYMBOLS; ++iI)
szString.append(CvWString::format(L"%c", gDLL->getSymbolID(iI)));

Please help me to figure what is wrong.. and if you give me a permission to translate the tutorial I would be please to present it to korean users.

Thanks~
 
Thanks :)

createTestFontString() was used for testing, and is not really needed. You can comment out the problematic line (the one with the non-English letters) - simply add // to the beginning of the line.
Alternatively you can save the file as unicode instead of ANSI.

Part 2 is just caused by the fact that in part 1 the compiler failed to compile a specific file. It should be solved when you solve part 1.

Of course you can translate the tutorial. Just please add a link back to this one. And I'd be interested in seeing it once you have it translated ;)
 
Thanks :)

createTestFontString() was used for testing, and is not really needed. You can comment out the problematic line (the one with the non-English letters) - simply add // to the beginning of the line.
Alternatively you can save the file as unicode instead of ANSI.

Part 2 is just caused by the fact that in part 1 the compiler failed to compile a specific file. It should be solved when you solve part 1.

Of course you can translate the tutorial. Just please add a link back to this one. And I'd be interested in seeing it once you have it translated ;)

Dear, Asaf
Thanks a lot, now it works.. it still got a warning though,
Now, I have a few more steps to go.. adding a couple of mods..
of course I'll add a link.. thank you again~
 
Any idea how to solve this?

1>CvUnit.cpp
1>CvUnit.cpp(5215) : error C2039: 'addPlotDangerSource' : is not a member of 'CvPlayerAI'
1> c:\Users\hsm\Desktop\CvGameCoreDLL\CvPlayerAI.h(13) : see declaration of 'CvPlayerAI'
1>NMAKE : fatal error U1077: '"C:\Dados\CIV files\Microsoft Visual C++ Toolkit 2003/bin/cl.exe"' : return code '0x2'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://c:\Users\hsm\Desktop\CvGameCoreDLL\Release\BuildLog.htm"
1>CvGameCoreDLL.2008 - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 
Add addPlotDangerSource to CvPlayerAI?
Is it defined outside of this class?

err ... I'm beginner ... in fact the only thing that changed in the original code were some lines which brought from another mod.

outside? The makefile has a supplement called Makefile-vars ...
 

Attachments

  • CvUnit_original.7z
    55.4 KB · Views: 61
  • CvUnit.7z
    55.5 KB · Views: 137
Well, you'll have to take the entire code of this mod. The code you have there uses other pats of the code which are defined in other files, and are needed for this to work properly.
Not to mention that it seems that it's also based on the unofficial patch, which contains a lot of changes to many files.
Try using the mod's source files and see if it compiles.
 
Well, you'll have to take the entire code of this mod. The code you have there uses other pats of the code which are defined in other files, and are needed for this to work properly.
Not to mention that it seems that it's also based on the unofficial patch, which contains a lot of changes to many files.
Try using the mod's source files and see if it compiles.

I can't compile the mod's source. Any suggestion?

1>'Makefile' is up-to-date
1> copy /Y Final_Release\CvGameCoreDLL.dll C:\Users\hsm\AppData\Roaming\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\Realism\Assets
1>A sintaxe do comando está incorreta. (tradution: The command syntax is incorrect)
1>NMAKE : fatal error U1077: 'copy' : return code '0x1'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://c:\Users\hsm\Desktop\CvGameCoreDLL\Final_Release\BuildLog.htm"
1>CvGameCoreDLL.2008 - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 
Which mod is it? Did you take its makefile as well? Or even VC project?
Was the DLL file created? If so, the compilation succeeded and it only failed copying it somewhere else, and you can copy it manually.
 
Which mod is it?
Realism Invictus - CvGameCoreDLL:
https://civ4mods.svn.sourceforge.net/svnroot/civ4mods/realism/bts/trunk/mod/GameCore/CvGameCoreDLL/
With this source is easier to say what I'm doing wrong?

Did you take its makefile as well? Or even VC project?
Yes, I take the makefile. They are two: makefile-vars and makefile. I change makefile-vars.sample to makefile-vars and ajust the path of files. The SLN and VC are in the source.

"copy /Y" is in makefile-vars, If I disable pasting "#" first appears a new error: Cannot enumerate resources in executable.

Was the DLL file created? If so, the compilation succeeded and it only failed copying it somewhere else, and you can copy it manually.
No...:sad:
 
Top Bottom