 |
|
Keygen
|
|
Athens, Hellas
Jan 2000 time: 07:31
|
|
Any further attempt to compile in VC++ .NET?
|
|
|  |
 |
|
Keygen
|
|
Athens, Hellas
Jan 2000 time: 07:31
|
|
Isn't there a utility that updates older code created in VC++ 6.0 in the VC++ .NET? I think they supposed to have such a tool but since I don't have VC++ .NET I can't be sure.
|
|
|  |
 |
|
george03
|
|
Hello!
Did anyone manage to get the source code compiled on VC++ .NET 2002 or 2003?
|
|
|  |
 |
|
Martin Gühmann
|
 |
Berlin, Germany
Mar 2001 time: 06:31
|
|
OK, I played around with .NET at uni. So far I was able to compile the mapplugins, but wasn't able to compile, dbgen.exe and the debug *.exe.
As I don't have administrator rights I had to replace all the appearance of CDKDIR again in all the *.dsp files first, then I had to convert the VC 6 dsw file to a .NET solution, note that you have to replace the CDKDIR refferences first otherwise you still have some refferences in .NET files.
Then I had to add the include stuff I did what Mr Ogre suggested in the other thread:
quote:
MAKE SURE THE INCLUDE PATHS FOR DIRECTX AND DXMEDIA COME FIRST IN YOUR SETTINGS. That is very important, especially for DirectX. If you don't do this step, you will get the wrong version of ddraw.h, the one that's included with VC++ 6.0 is horribly outdated. Go to Tools->Options->Directories, Include Files, and put C:\DXSDK\Include at the top of the list, and just under it, add c:\DXMedia\include and then c:\DXMedia\classes\base. That assumes you installed them to DXSDK and DXMedia.
Copy the libraries into the ctp2 libs folder:
copy c:\dxsdk\lib\*.lib (ctp2_src)\libs\directx\lib
copy c:\dxmedia\lib\*.lib (ctp2_src)\libs\dxmedia\lib
|
You find the include places under: Tools->Options->Projects->VC++ Directories
I added under as first directory: Show directories for Executable file
Z:\RAID\CTP2\ctp2source\bin
That's the directory of the binaries like bison or flex.
Under include files:
Z:\RAID\CTP2\DXSDK\include
Z:\RAID\CTP2\DXMedia\classes\base
Z:\RAID\CTP2\DXMedia\include
The stuff for direectX and direct media.
And under Libary files well nothing and I thought I put there the libaries, however I copied like Mr Ogre the libary stuff.
And then I changed in Project->Properties->Linker->Advanced Target Machine from MachineX86 (/MACHINE:X86) to Not Set.
I think this should be done but so far I wasn't able to test it whether this has any effect, because I got these error messages:
code:
------ Build started: Project: dbgen, Configuration: Debug Win32 ------
Performing Custom Build Step
"", line 1: premature EOF
/cygdrive/z/Raid/CTP2/ctp2source/bin/flex: could not create z:\Raid\Ctp2\ctp2source\ctp2_code\gs\dbgen"lex.yy.c z:RaidCtp2ctp2sourcectp2_codegsdbgenctpdb.l
Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"
Build log was saved at "file:// z:\Raid\Ctp2\ctp2source\ctp2_code\gs\dbgen\Debug\B
uildLog.htm"
dbgen - 1 error(s), 0 warning(s)
I see that the '' are missing in the path name but I don't know why.
-Martin
|
|
|  |
 |
|
vovan
|
|
Martin,
As per Microsoft's C++ Reference:
quote: The Standard Template Library (STL) sequence container deque arranges elements of a given type in a linear arrangement and, like vectors, allow fast random access to any element and efficient insertion and deletion at the back of the container. However, unlike a vector, the deque class also supports efficient insertion and deletion at the front of the container. |
Note the last sentence. So, the replacement of the deque with the vector might slow down the ai scheduling, if they do a lot of pushing and popping, though I imagine if that were the case, a stack might have been better. (Though, of course, underneath it uses a deque any way.)
|
|
|  |
 |
|
vovan
|
|
Don't know if anyone cares now, but I have successfully compiled the game on Visual Studio.NET just now. (That's .net 2002 + sp2, not 2003.) I documented everything I did as I went, so all the steps should be there:
1. Copied everything to C:\CTP2 after installation so as to not have any spaces in the path - just easier that way.
2. Opened up the ctp\civctp.dsw workspace.
3. Clicked "Yes to All" to convert all projects to new format.
4. Clicked "Build Solution".
5. Could not find "reftime.h"
6. Read the readme. And realised I didn't have DirectX Media SDK installed, only the DirectX SDK.
7. Downloaded and installed DirectX Media SDK.
8. Now, all projects except ctp2 built. The latter has 732 errors, and 1264 warnings.
9. A lot of the errors seem to come from the list-fixed header. So, introduced a new symbol for conditional compilation: USE_OLD_LIST_FIXED. Everything that included that one, now checks for the symbol. If the symbol is defined, list-fixed is used. Otherwise, the standard <list> is used. This change affected the following files: gs\gameobj\gaiacontroller.h; ai\diplomacy\Diplomat.h; ai\diplomacy\foreginer.cpp; ai\strategy\scheduler\Plan.h; ai\strategy\scheduler\scheduler.cpp; ai\strategy\scheduler\scheduler_types.h; ai\mapanalysis\settlemap.h. This helped some, as there were now 592 errors and 631 warnings.
10. But there still were problems with the standard library. It seemed the dbgallocator thingey might be responsible. So, I went to c3debugstl.h and used a new preprocessor symbol: USE_OLD_DBGALLOCATOR. If it is defined, then the dbgallocator class is used. Otherwise, it is just defined as std::allocator. This helped a lot, as there were now 150 errors and 732 warnings.
11. There was now the following last problem with the STL. The deque class used in the ai\strategy\scheduler\Scheduler class, attempts to find out the size of its template parameter using sizeof. However, we typedef a deque of Schedulers *inside* the scheduler class, hence at that point the class hasn't been defined yet (despite the forward delaration in the beginning of the header file), and hence sizeof fails with an error: "Use of undefined type 'Scheduler'". To work around that, I used yet another preprocessor symbol: USE_DEQUE_CONTAINER. If the symbol is defined, the deque is used as per the original code. Otherwise, a vector is used instead, as first proposed by Martin Guehmann. The problem count is now down to 118 errors, and 315 warnings. What's more, there are no more STL errors. Wohoo! 
12. Next up, I wanted to fix up the sound, so I got the mss.h/mss.lib from Apolyton, and that worked. Thanks, jonwil. The problem count is now at 67 errors and 300 warnings.
13. Then, there was the deprecated std::_MAX macro. To take care of that, just replaced it with max whereever used. As well, the std::_MIN call was replaced with min. The affected files were: ui\aui_common\aui_control.cpp and ui\aui_ctp2\Original\radarmap.cpp. Note that min and max are windows-specific macros, however. It would be better to use std::min and std::max instead, but for those calls not to clash with the macros, one would need to #define NOMINMAX before #including <windows.h>. I was too lazy to search for that include, however, so I just used the macros. That got the problem count down to 45 errors and 17 warnings. (Note that I am not rebuilding the things that have already been built successfully, so the low warning count isn't really indicative of anything.)
14. Next, I decided to take care of a simple problem - the sizeof(enum) thing. I replaced that with enum CIV_INDEX, just 'cause it seemed that that's the enum that is being written, though I didn't read into the code much, so maybe just replacing this with sizeof(int) would have been a better workaround. Two more errors off.
15. Then there were the networking "reference to nonstatic member" problems. As per Ralph's solution, just replaced them all with NULLs for the time being. The files affected here were ui\netshell\ns_aiplayer.cpp, ui\netshell\ns_aiplayersetup.cpp, ui\netshell\ns_game.cpp, ui\netshell\ns_gamesetup.cpp, ui\netshell\ns_gplayer.cpp, ui\netshell\ns_lobby.cpp, ui\netshell\ns_player.cpp, ui\netshell\ns_playersetup.cpp, ui\netshell\ns_rplayer.cpp, ui\netshell\ns_server.cpp, ui\netshell\ns_session, and ui\netshell\ns_transport.cpp. Down to 8 errors, and 14 warnings.
16. Then, for some odd reason, there was a simple error. in gs\slic\SlicEngine.cpp, line 965 was like this:
symStart = 0;+
Note the plus on the end. Naturally, that caused an error. Fixed that.
16.5. I also had the problem of the compiler complaining about redefined InterlockedExchange in combase.h of the DirectX Media. Just commented that inline definiteion out, as mjs0 suggested.
17. Now, there was the following problem. In gs\slic\slicif.cpp, there are a few lines of code repeated in some functions, that read like this:
SlicDBInterface *conduit = (SlicDBConduit *)dbptr;
Now, SlicDBConduit is a templated class, hence the compiler was complaining that there are no template parameters. I replaced all five instances of this cast with:
SlicDBInterface *conduit = (SlicDBInterface *)dbptr;
That took care of that problem.
18. Next, a few more errors showed up. In ui\netshell\netfunc.cpp, the templated versions of the Handle function were not implemented according to the standard, and hence, whenever Insert(Add(new T(t))); was called, I got a "Unknown identifier 'T'" error. I had to replace that with the correct template parameter manually, like so:
bool NETFunc::ListHandler<NETFunc::Server>::Handle(Message *m) {
...
Insert(Add(new T(t)));
went to
bool NETFunc::ListHandler<NETFunc::Server>::Handle(Message *m) {
...
Insert(Add(new NETFunc::Server(t)));
And so on. After these changes, there were no more compilation errors.
19. Now, I got some linking errors about missing libraries for DirectX, and MirectX Media. Including those fixed the linking problem as well. The thing built! 
20. But, it didn't run. Missing msvcrtd.dll, it said. Linking with anet2.lib instead of anet2d.lib fixed that problem, however. Thanks, mjs0. After this, everything seems to work, though I don't have the rest of the game, so I can't check. Gotta look for that CD some more. 
Last edited by vovan on 31-05-2004 at 08:20
|
|
|  |
 |
|
vovan
|
|
That's odd. I definitely did not have that problem. Maybe it's a Visual Studio 7.0 vs 7.1 thing?
|
|
|  |
All times are GMT. The time now is 05:31. Apolyton Time is 00:31. |
top of page
|
|
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|