Installing and using the SDK

c.fe said:
I can just confirm that it crashes, too, when I use VC 2005. And the dll is 500 KB smaller.

I'm nevertheless impressed how you solved the compile problem. As I see it there is no direct connection between the error and the code line :confused:

The dll I got was exactly the same size (in KBs at least, didn't check the bytes) as original. I might play around with it on the weekend to see if there is anything else we can do other than change the compiler.

And I killed most of the easter weekend to get the walkaround, so there is really nothing to be impressed about :)

One more thing about this, is that it actually crashes when loading XMLs not Python. If you enable logging, you can see that it crashes somewhere in between CIV4BuildInfos.xml and Units/CIV4UnitInfos.xml
 
*Sigh*
Another error. When I try to build the SDK, an error pops up that says "can't find compiler executable in your search path for Microsoft Visual C++ Toolkit 2003"
 
Suchy_63 said:
The dll I got was exactly the same size (in KBs at least, didn't check the bytes) as original. I might play around with it on the weekend to see if there is anything else we can do other than change the compiler.

Well, i can't guaranty that i didn't change any of the compiler options.

Suchy_63 said:
And I killed most of the easter weekend to get the walkaround, so there is really nothing to be impressed about :)

At least you got something. I was completly confused by the error message and by strange tricks (strange for someone who isn't a c++ veteran) boost used in its source.

Suchy_63 said:
One more thing about this, is that it actually crashes when loading XMLs not Python. If you enable logging, you can see that it crashes somewhere in between CIV4BuildInfos.xml and Units/CIV4UnitInfos.xml

The is unexpected... And again I do not understand it... :crazyeye:
 
Lord Olleus said:
which one? There's three Windows Server 2003 R2 SDK - March 2006 Edition ISO Download, Windows® Server 2003 R2 Platform SDK ISO Download, Windows® Server 2003 SP1 Platform SDK ISO Install.

Also their all .img, what do I use to open them? and how come their 100 times bigger than the other file?

Please help me I am so very confused.

I noticed that Microsoft replaces the 2003 toolkit. I put up a valid link to it in the first pit.
 
Did some more research on VC8 and SDK. It appears the crash happens because memory footprint of classes generated by VC71 and VC8 is not identical. In particular, the order of methods in virtual method table generated by VC80 is different from what Civilization executable expects.

So the only way to make this work with civ4 executable is by recompiling it with VC8 as well. Since this is not possible, we have to use vc71 compiler.
 
Since the files are basically text files, you could probably just load each file one by one into another compilier. I'm not sure how compatible a new C++ version DLL (done with 8.0 vs. 7.1) will be, though.
 
Chieftess said:
Since the files are basically text files, you could probably just load each file one by one into another compilier. I'm not sure how compatible a new C++ version DLL (done with 8.0 vs. 7.1) will be, though.

Suchy is speaking of the civ4.EXE which is incompatible with the DLL compiled with vc80. There is no way to recompile the EXE without having the sources of the EXE. But have it for the DLL only.

So there is no way.
 
Suchy_63 said:
Did some more research on VC8 and SDK. It appears the crash happens because memory footprint of classes generated by VC71 and VC8 is not identical. In particular, the order of methods in virtual method table generated by VC80 is different from what Civilization executable expects.

So the only way to make this work with civ4 executable is by recompiling it with VC8 as well. Since this is not possible, we have to use vc71 compiler.

And there's no switch to compile with the vc71 method? :mad: :mad:
 
Hello all, just wondering if anybody could help me getting the SDK working in codeblocks.

I've followed all the steps mentioned in the first post: the main problem I have was that I couldn't get msvcrt.lib and msvcrtd.lib as the link given didn't work for me (It kept saying invalid session). I've installed the .Net runtime, but a search of my system doesn't reveal the files. Eventually I found them in an old copy of VS 6 that I found lying around but seeing as this dates from 1998 I'm not sure whether I've installed the right versions.

Anyway, when I try to compile I get lots of errors similar to the following:

_precompile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall bad_cast::bad_cast(char const *)" (__imp_??0bad_cast@@QAE@PBD@Z)

Does this look like it's something that could be caused by an incorrect version of msvcrt.lib and if so where's the best place to look for it (I'm currently downloading the .Net sdk to see if it is in there). If not, any other clues to what I'm doing wrong would be much appreciated.

Thanks,

Chris
 
Since it boils down to the dreaded .exe, I guess that'd mean the only ways to get a working version out of VS8 would be to either: trick VS8 into using the 7.1 compiler somehow; or hope that Firaxis incorporates some kind of "fix" for this likely-unforeseen issue, whether it be as a patch or a part of the Warlords expansion.

Unfortunately, I can't really say if either is even possible, much less likely. Chances are that we'll have to use another IDE (like CodeBlocks) to get the job done. It's really too bad, now that the software is freely available not until November, but permanently (see question 11 in their FAQ).
 
mjs0 said:
It turns out that even though I was using /MD (standard multi-threaded runtime for DLLs) rather than /MDd (debug multi-threaded runtime for DLLs) it was still pulling in one of the debug libraries (msvcprtd.lib).

Same problem here!
I followed the instructions in post #1 of this thread an use the codeblock editor with the MSVC++ Toolokit 2003 compiler. The linker says: "cannot open file 'msvcprtd.lib'"

I have no idea why this was pulled in to the linked DLL so I took the brute force approach of specifically excluding that library and adding the standard equivalent (msvcprt.lib) to the additional dependencies list.

Can you tell me how to do this? I cannot find the option to exclude a library.

Matze
 
MatzeHH said:
Same problem here!
I followed the instructions in post #1 of this thread an use the codeblock editor with the MSVC++ Toolokit 2003 compiler. The linker says: "cannot open file 'msvcprtd.lib'"



Can you tell me how to do this? I cannot find the option to exclude a library.

Matze

Do you have a msvcprtd.lib file in your 'C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib' directory?
 
Kael said:
Do you have a msvcprtd.lib file in your 'C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib' directory?

Of cause not. This file is not freely distributed by Microsoft.
But mjs0 was talking about the linker option "Multi-Threaded DLL Runtime Library [/MD]", which should not use the msvcprtd.lib but the msvcprt.lib, which is delivered with the toolkit.
Switching on that linker option did not solve the problem, because the linker still searches the msvcprtd.lib.
He solved that problem by manually excluding the msvcprtd.lib, but didn't tell us, how.

Matze
 
MatzeHH said:
Of cause not. This file is not freely distributed by Microsoft.
But mjs0 was talking about the linker option "Multi-Threaded DLL Runtime Library [/MD]", which should not use the msvcprtd.lib but the msvcprt.lib, which is delivered with the toolkit.
Switching on that linker option did not solve the problem, because the linker still searches the msvcprtd.lib.
He solved that problem by manually excluding the msvcprtd.lib, but didn't tell us, how.

Matze

If you downloaded all the components which include VC++ toolkit 2003,platform SDK, the 3 libraries msvcprt, msvcrt, and msvcrtd and codeblocks. After you have installed the VC++ toolkit 2003 place the three library files into the C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib folder. After that its about setting up codeblocks. All of these components can be found in the 1st post before the picture diagrams. If this doesnt work you most likely didnt get the library files.
 
d80tb7 said:
Hello all, just wondering if anybody could help me getting the SDK working in codeblocks.

I've followed all the steps mentioned in the first post: the main problem I have was that I couldn't get msvcrt.lib and msvcrtd.lib as the link given didn't work for me (It kept saying invalid session). I've installed the .Net runtime, but a search of my system doesn't reveal the files. Eventually I found them in an old copy of VS 6 that I found lying around but seeing as this dates from 1998 I'm not sure whether I've installed the right versions.

Anyway, when I try to compile I get lots of errors similar to the following:

_precompile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall bad_cast::bad_cast(char const *)" (__imp_??0bad_cast@@QAE@PBD@Z)

Does this look like it's something that could be caused by an incorrect version of msvcrt.lib and if so where's the best place to look for it (I'm currently downloading the .Net sdk to see if it is in there). If not, any other clues to what I'm doing wrong would be much appreciated.

Thanks,

Chris

I got the same thing while I was using the Aol browser, minimize your current browser (dont close as that will disconnect you from the internet) open up internet exlplorer( the msn browser will pop up). go to the civfanatics website from the MSN browser. Follow the links back to this thread and try to download the file again. You should have no problem this time.
 
Aussie_Lurker said:
Oh, and a 3rd question. I assume that the file is located within the Civ4_SDK_Platform folder. Only problem is that there are two GameCoreDLL files in there, one a C++ Source file, the other a Header file-which do I actually open? Or is there a 3rd one I am unaware of? Hope that all makes sense.

The name of the file is CvGameCoreDLL.vcproj. If you cant see the full extension. You will need to select Tools then Folder options and then View. Scroll down and uncheck the Hide extensions for known file types box.
You should now be able to view all the files with all there extensions.
then up the file listed above.
 
dlordmagic said:
If you downloaded all the components which include VC++ toolkit 2003,platform SDK, the 3 libraries msvcprt, msvcrt, and msvcrtd and codeblocks. After you have installed the VC++ toolkit 2003 place the three library files into the C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib folder. After that its about setting up codeblocks. All of these components can be found in the 1st post before the picture diagrams. If this doesnt work you most likely didnt get the library files.

These 3 libraries are there.
Just to make myself clear: i can compile the project and it works fine in release mode. But the goal is to make the debug mode work. mjs0 said he succeeded by making the above mentioned steps.

I also had some success:
I simply made a copy of msvcprt.lib and renamed it to msvcprtd.lib.
Then I could compile the project and start the game, but it didn't stop at my breakpoints. First, I figured out, that the debugger included with Code::Blocks doesn't work with the MSVC++ 2003 compiler.
Then I downloaded "Debugging Tools for Windows" from Microsoft.
This program told me, that there is no debug information in my project.
So, I activated the compiler flag /Zi (Produce debugging symbols).
Well, now I have the compiler error C1067: compiler limit: debug information module size exceeded.

Matze
 
MatzeHH said:
Of cause not. This file is not freely distributed by Microsoft.
But mjs0 was talking about the linker option "Multi-Threaded DLL Runtime Library [/MD]", which should not use the msvcprtd.lib but the msvcprt.lib, which is delivered with the toolkit.
Switching on that linker option did not solve the problem, because the linker still searches the msvcprtd.lib.
He solved that problem by manually excluding the msvcprtd.lib, but didn't tell us, how.

Matze

Unfortunately, since I am not using the CodeBlock editor I don't know where in that UI you would set this linker option.
In VisualStudio.NET 2003 it is in the project properties dialog in the "Configuration Properties/Linker/Input" section as 'Ignore specific library'
If it helps, this manifests on the linker command line as /NODEFAULTLIB:"msvcprtd.lib"
You then have to explicitly pull in msvcprt.lib to replace the debug version you just excluded.

I still had to start CivilizationIV.exe as a separate process then attach to that process from VS2003. Once I did that I could debug perfectly, set breakpoints, change variable values, etc...
 
mjs0 said:
If it helps, this manifests on the linker command line as /NODEFAULTLIB:"msvcprtd.lib"
You then have to explicitly pull in msvcprt.lib to replace the debug version you just excluded.

Yea, that helps! Thanks.

Do you use the compiler option /Zi?

Matze
 
Back
Top Bottom