Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Call To Power II > CtP2-Source Code Project > COMPILE: Getting the source to compile on VS.NET
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
CivGroups
CTP2 Source Code Project (59): Not a Member - Join

bottom of page
  
Author
Thread   
Pages (3): [ 1   2   3   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
vovan is offline vovan
Emperor

Oct 2001
time: 06:31
  Old Post 29-10-2003 22:39
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Getting the source to compile on VS.NET Increase Your PM Length

Okay, the Getting the source to compile thread is great, but it is starting to overflow with different kinds of information. I think it would be good to keep different discussions separate, and since that other thread has pretty much gotten to the point of taking care of CivSound, I thought a new thread for us VS.NET users is in order. So, the progress I have achieved so far is this:

The conversion from VS6.0 files to .NET was successful, and I had no problems with the quotes as people in the other thread have said. The problems I did have were as follows:


  • Custom Build Step couldn't find byacc and bison.
    Solution: Put the binaries into some path that does not contain spaces in it.

  • byacc couldn't find the source file.
    Solution: Put the source files into some path that doesn't contain spaces in it.

  • byacc: f - cannot open "/tmp/yacc.aa####"
    Solution: Create a C:\tmp directory (or replace the C: drive with whichever one you have your byacc on).
    Alternative Solution: Create an environment variable "TMPDIR" that points to a temp directory (e.g.: "%systemroot%\TEMP").
    (Atahualpa)

  • The definition of dbgallocator in c3debugstl.h doesn't match what's required for the new STL.
    Solution: Some template defintions now require the additon of the typename keyword to compile.
    (RalphTrickey)

  • Some of the math functions (sqrt, ceil, floor) now require floats instead of integers.
    Solution: Cast them to double. I think that I remember one that had ceiling of a number divided by 2. This will always return the floor instead. These should be fixed and documeted for anyone working on v6.
    (RalphTrickey)

  • The definition of dbgallocator in c3debugstl.h doesn't match what's required for the new STL.
    Solution: For now, do a global search and replace of dbgallocator< with std::allocator<
    (RalphTrickey)

  • Ambiguous overload.
    Solution: The line
    aui_TextBase((MBCHAR *)NULL, (uint32)0)

    needs to be

    aui_TextBase((const MBCHAR *)NULL, (uint32)0)
    (RalphTrickey)

  • std::_MAX has changed.
    Solution: Replace with max
    (RalphTrickey)



-----------------

I was thinking that this would be a good start for sort of an FAQ, or step-by-step instructions, on how to get the thing to compile on .NET. So, if anyone has made more progress than I have, please post here, and I will update the list above.

Last edited by vovan on 03-11-2003 at 07:19

vovan is offline vovan
Emperor

Oct 2001
time: 06:31
  Old Post 30-10-2003 00:02
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

Okay, there is definitely something screwed up with the different versions of the STL. The fixed-list header references certain members of classes with too few template parameters, and then if I use the regular list, then there are some other errors like that, too. So, my idea at first was to download the latest version of the STL, and see if that helps any. Now that I've seen how many more errors it's produced, I realize that is rather stupid, taking into consideration the age of the game.

So, the next great idea is this: could one of you kind folks that uses VS 6.0 zip up the includes folder and post it here / PM it to me? I'm thinking the older version of the STL might do the trick. Either that or feel free to post why such an idea is completely wrong and any better ideas if any.

Pyaray is offline Pyaray
Warlord
Santa Ana, CA, USA
Oct 2000
time: 21:31
  Old Post 30-10-2003 02:50 Visit Pyaray's homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Enter the AD-FREE zone

Oh, this thread is ringing a rusty and cobwebbed bell in the back of my cranium.

There is an "unofficial" STL fix for the MS STL. I don't remember where it came from, but I think that we used a non Microsoft version of STL.

I'm sorry, I know this isn't much help, given that I don't recall where we got it. But I don't think there are any differences between the .net & the vs6 STL.

Pyaray

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 30-10-2003 06:33
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Re: Getting the source to compile on VS.NET Support Apolyton, buy GURPS/ Alpha Centauri

quote:
Originally posted by vovansim
4. Now I am having plenty of errors in regards to the STL and the use of incomplete definitions (like, typedefing a deque template with the class parameter from within that class. While that is allowed for compilation, it isn't handled correctly by .NET for some reason.)
Solution: None that I can see right now.


The problem here is that it is DEFINING an instance of the type (s_Scheduler(?) inside the class. The definition now requires the size of the item.

Solutions...

Short term.. Move s_Scheduler out of the class and into a static variable in the.cpp file.

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 30-10-2003 06:49
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Put an end to popups!

Problem...
The definition of dbgallocator in c3debugstl.h doesn't match what's required for the new STL.

Solution...???

Ralph

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 30-10-2003 06:51
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Got spare money?

Solution...
some template defintions now require the additon of the typename keyword to compile.

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 30-10-2003 06:59
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Suffering from ads?

Problem...
some of the math functions (sqrt, ceil, floor) now require floats instead of integers.

Cast them to double. I think that I remember one that had ceiling of a number divided by 2. This will always return the floor instead. These should be fixed and documeted for anyone working on v6.

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 30-10-2003 08:36
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Full PM-box? Change here!

quote:
Originally posted by RalphTrickey
Problem...
The definition of dbgallocator in c3debugstl.h doesn't match what's required for the new STL.

Solution...???

Ralph

For now, do a global search and replace of dbgallocator< with std::allocator<

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 30-10-2003 08:40
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton, buy Call to Power 2

Problem...
the NS_ files (for example ns_games) don't compile as is. I'm not sure what they are supposed to do, or what they do in V6.

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 30-10-2003 08:41
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

Problem...
Ambiguous overload.
Solution...
The line
aui_TextBase((MBCHAR *)NULL, (uint32)0)

needs to be

aui_TextBase((const MBCHAR *)NULL, (uint32)0)

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 30-10-2003 09:14
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Got spare money?

problem...
std::_MAX has changed.
solution
replace wiht max

vovan is offline vovan
Emperor

Oct 2001
time: 06:31
  Old Post 30-10-2003 21:47
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Get a bigger avatar today!

Thanks, Ralph! That fixed a bunch of errors. I'm thinking now it would be nice to actually implement the changes we make this way in such a way that it doesn't screw things up if we share the code between the people on VS 6 and VS.NET. Probably a good idea to have some #ifdefs in there.

And also, Pyaray, thanks for your response. The list-fixed file contains this comment:

// REM102200: fixed as per http://www.dinkumware.com/vc_fixes.html

So, I suppose that's where the fix was gotten from. Or was list not the only fix you used?

Pyaray is offline Pyaray
Warlord
Santa Ana, CA, USA
Oct 2000
time: 21:31
  Old Post 31-10-2003 02:18 Visit Pyaray's homepage!
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Inflate your Upload Space

I'm afraid I don't remember, and I'm not sure I ever actually had that knowlege. The build environment was already set up for me when I got there. Remember that I joined the team really late in development.

Pyaray

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 31-10-2003 02:28
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Avatar Enlargement: We've got the solution

Problem...
The ns_files won't compile.
Work-Around...
Code like the follwing...
ns_AIPlayer::Struct ns_AIPlayer::list[] = {
{STRING, 0},//(Data)&m_name},
{STRING, 0},//(Data)&m_tribe},
{INT, 0},//(Data)&m_civpoints},
{INT, 0},//(Data)&m_pwpoints}
};
Solution...
???

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 31-10-2003 02:30
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Browse Apolyton AD-FREE

Problem...
sizeof(enum) is undefined
Work-around... For now, use sizeof(int)
solution...
??? Possibly see what it's used for/see what value vc6 has.

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 31-10-2003 03:16
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Lose 30 kilos (of popups)

Everything compiles and links, now for the unable to load dll errors...

mjs0 is offline mjs0
Settler
Florida, USA
Jun 2001
time: 00:31
  Old Post 31-10-2003 03:30
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Increase Your PM Length

quote:
Originally posted by RalphTrickey
Everything compiles and links, now for the unable to load dll errors...


Believe it or not I have just this second finished my first move in debug mode!

I also had some issues with dll load failures.
My problem was caused by anetd.dll which was built with an older version of VC++ and linked in msvcrtd.dll which does not exist for VS.Net.
I got around the problem by linking the debug build with anet.lib instead of anetd.lib.

After that everything ran beautifully until I quit at which point I got a debug assertion raised in resource.cpp line 171.

Martin.

mjs0 is offline mjs0
Settler
Florida, USA
Jun 2001
time: 00:31
  Old Post 31-10-2003 03:52
Edit/Delete Message Reply w/Quote
#18 Report this post to a moderator
Get a bigger avatar today!

Just looking back over my notes of things I had to change to get to this point.

One of the things that really stands out is how little trouble there was with DXMedia/DirectX, especially compared to the VS6 thread on this forum.

For DirectX I used the latest DX9 SDK and all I had to do for DXMedia was make a couple of simple changes to combase.h and refclock.h

If I read my notes right I had to
1. comment out an inline definition for InterlockedExchange in combase.h (as .net supports volatiles passed directly to this API)

2. Change #include to #include "schedule.h" as the former was pulling in the runtime version of schedule.h instead of the DXMedia version. This was causing multiple failures due to the resulting absence of CAMSchedule.

(I know there are more elegant fixes to both of these issues!)

Did others see only these DXMedia issues?

For the mss.h issue I simply created stubs for each of the missing functions (and put them in civsound.h) plus ensured they returned an error when appropriate.

I'll try to get my notes in decent shape and post a detailed list of the steps I went through later this evening. (The list will have significant overlap with what is already on here but hopefully will still prove valuable.)

Martin.

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 31-10-2003 04:38
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Increase the size of your Attachments

Thanks for the hint about anet.

I didn't have any issues related to DirectX or DirectMedia. I did have to add several header files that weren't included, they were probably moved around.

I do have a problem where running at startup fails when It tries to call a routine to get the cpu frequency in c3cpu. This causes problems for me with the mouse move function not working.

When I commented that out, I was able to run and I get the same failure that you do with the assertion.

It was surprisingly painless, although for me, sound and the networking stuff is commented out.

I was able to save and load a game.

Ralph

george03 is offline george03
Settler

Nov 2003
time: 05:31
  Old Post 03-11-2003 00:23
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
Support Apolyton, buy Call to Power 2

I'm sorry, but can some of you guys who understand this whole thing better, please help me out. First of all, I use VC 2003, i.e. v 7.1 (but I suppose it should not bee too different from 2002 - 7). Ihave a few questions:
1. I installed DX 9 SDK. But I don't have DX Media 9 SDK, and cannot download it - it's just way too big. Can anyone tell me what is the solution? Does anyone have the actual files it refers to - i.e. reftime.h?
2. What should be done to the sound system, to get around miles library? The were several work arounds, but which one is better?
3. I seem to have a lot of problems with PointerList.h - has anyone manged to get through it?
4. Perhaps someone can post a working .ent compiled version once he manages to do it. This will make may things easier for others.
Thanks a lot.

Atahualpa is offline Atahualpa
Emperor
Hawthrone
Mar 1999
time: 06:31
  Old Post 03-11-2003 04:17 Visit Atahualpa's homepage!
Edit/Delete Message Reply w/Quote
#21 Report this post to a moderator
Browse Apolyton AD-FREE

quote:
byacc: f - cannot open "/tmp/yacc.aa####"
Solution: Create a C:\tmp directory (or replace the C: drive with whichever one you have your byacc on).


Alternative Solution: Create an environment variable "TMPDIR" that points to a temp directory (e.g.: "%systemroot%\TEMP"). That way you dont need to create a directory at c: level (if you dont like that for some reason).
TMPDIR is the env variable that byacc will look for and will default to /tmp if not found.

Anybody already got a compilable version (except mss.h errors which are obvious) of the source under .net?

ata

Atahualpa is offline Atahualpa
Emperor
Hawthrone
Mar 1999
time: 06:31
  Old Post 06-11-2003 20:41 Visit Atahualpa's homepage!
Edit/Delete Message Reply w/Quote
#22 Report this post to a moderator
Support Apolyton

hmmm I still try to compile it under .NET though still having difficulties

I commented the #include lines out and tried it with the .NET version of with moderate success:
#ifdef VSNET
#include
#else
#include
#endif

Then I had the problem that in template class list there are 2 typedefs that use _Node and _Genptr from _List_nod but they are protected and list constantly complains that it cannot access these protected member values.
So I changed in that I replaced protected in _List_nod with public.
Seems to work. Its strange though because _Node is declared friend and as far as I am informed is therefor accessible outside the current scope.
However I dont think it is great to mess around with the STL includes, so this may not be the best fix.

I also changed the Scheduler thing as advised here and then recompiled.

79 Errors left (and 1050 warnings )

though some of the errors are related to the _MAX macro things for which there is a solution here but I havent addressed it yet.

Then there are still a lot illegal references to non-static members all in ui\netshell\ns_*.cpp ( I have no idea what they are all about or how to fix them [except maybe writing static in front ])

the others are still errors in and

Overall I think I have to get a lot more experience with c++ and STL
The C++ programming language book by Bjarne Stroustrup is lying next to me (but hasnt been of much help). Nevertheless I think I should read it.

Anyone else made any progress?

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 07-11-2003 10:22
Edit/Delete Message Reply w/Quote
#23 Report this post to a moderator
Increase the size of your Attachments

Atahualpa,
Look up in this thread, and you'll see a work-around to the NS_ issue.

I changed the stl headter ot and that seemed to fix many issues with the list class.

I've actually gotten it to run, but then I modified something in the CTP2 options, and haven't been able to get it to run since.

Anyone know where the options are stored?

Ralph

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:31
  Old Post 07-11-2003 11:24 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#24 Report this post to a moderator
Support Apolyton buy from Amazon

In userprofile.txt (in the same folder as the executable).

Atahualpa is offline Atahualpa
Emperor
Hawthrone
Mar 1999
time: 06:31
  Old Post 07-11-2003 14:30 Visit Atahualpa's homepage!
Edit/Delete Message Reply w/Quote
#25 Report this post to a moderator
Avatar Enlargement: We've got the solution

Ralph: oops I should have checked the thread more intense. I also ran into the sizeof(enum) thing. I thought WTF???

Can somebody with VC6 compile this little program:

code:
#include <iostream.h> #include <conio.h> int main(int argc, char** argv) { int test; test = sizeof(enum); cout<<"sizeof(enum): "<<test; getch(); return 0; }


I hope that compiles, I always mix c and c++ ^^

I dont know when I can give it another shot at compiling because I dont have much time.

Btw: the list thing? Is this a bug in the MS STL?

ata

edit: in between [ code ] this forum could really replace < with &lt; and > with &gt;

Last edited by Atahualpa on 07-11-2003 at 14:48

Atahualpa is offline Atahualpa
Emperor
Hawthrone
Mar 1999
time: 06:31
  Old Post 07-11-2003 21:05 Visit Atahualpa's homepage!
Edit/Delete Message Reply w/Quote
#26 Report this post to a moderator
Increase Your PM Length

Ah yes I have found an interesting mail:

http://groups.google.de/groups?selm...8&output=gplain

quote:
[..]The size of an enumeration *type* is implementation-defined, while the size of an enumeration *constant* is the size of an int.[..]


I guess its okay to write sizeof(int) then

Fromafar is offline Fromafar
Prince

May 2003
time: 06:31
  Old Post 07-11-2003 23:05
Edit/Delete Message Reply w/Quote
#27 Report this post to a moderator
Support Apolyton, buy Civilization 2

VC6 has sizeof(enum): 4

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 08-11-2003 02:38
Edit/Delete Message Reply w/Quote
#28 Report this post to a moderator
Support Apolyton buy from Amazon

quote:
Originally posted by Locutus
In userprofile.txt (in the same folder as the executable).

Thanks. I deleted it, and everything works again.

Atahualpa is offline Atahualpa
Emperor
Hawthrone
Mar 1999
time: 06:31
  Old Post 08-11-2003 18:55 Visit Atahualpa's homepage!
Edit/Delete Message Reply w/Quote
#29 Report this post to a moderator
Tired of ads?

Anyone found a solution to the netshell thing already? (not a compiler-work-around)

I really like to know how on earth that can compile on VC6!?!?!! illegal reference to non static member is not something VS.NET specific.

The problem is that list is declared static in ns_accessor.h and yet you want to add non static members of ns_AIPlayer for example. This can never work out!!! I dont get it. How should the executable know which object's member variable to add to the list.

Besides can someone explain what this should do? There must be another solution to this.

ata

RalphTrickey is offline RalphTrickey
Settler
Colorado Springs
Oct 2001
time: 22:31
  Old Post 09-11-2003 07:16
Edit/Delete Message Reply w/Quote
#30 Report this post to a moderator
Increase the size of your Attachments

quote:
Originally posted by Atahualpa
Anyone found a solution to the netshell thing already? (not a compiler-work-around)

I really like to know how on earth that can compile on VC6!?!?!! illegal reference to non static member is not something VS.NET specific.

The problem is that list is declared static in ns_accessor.h and yet you want to add non static members of ns_AIPlayer for example. This can never work out!!! I dont get it. How should the executable know which object's member variable to add to the list.

Besides can someone explain what this should do? There must be another solution to this.

ata


This code is clearly illegal. I'll bet that on VC6, the code does something like... ns_array[0].data = &ns_array[0].text, that is it implicitly access the n'th array on the right hand side during the assignment. The solution is to break it into two parts, the main part is similar to what I posted above. The second part is in the initialization section, to actually make the assignments. I played with this a little, but coudn't get the cast right.

Ralph

 
Pages (3): [ 1   2   3   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:31.
Apolyton Time is 00:31.
    top of page
Rate This Thread:
Forum Jump:
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
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0556 seconds (92.20% PHP - 7.80% MySQL) with 36 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net