Home » SIRTECH CLASSICS » Jagged Alliance: Unfinished Business » Vanilla Modding » Compiler Problem
Compiler Problem[message #102395] Sun, 28 May 2006 14:50 Go to next message
KeldorKatarn is currently offline KeldorKatarn

 
Messages:37
Registered:May 2006
Location: Germany
Hi guys,

I downloaded the JA2 source code (the original one, no 1.13 or UB) and tried to compile it with VC++ 2005. I get many errors that I think may be caused by the fact that the code is C and I am trying to compile it as C++.
Can anyone confirm this? How much work is it to tweak the code far enough towards C++ to make it at least ready to be compiled any working without transforming the entire code to C++?
I just wanted to play aroung with the code a bit, I didn't plan on making any major changes, since I don't have time for that right now anyway. So I'd just like to get the code to compile so I can try out a few changes and see what they do to the game. But so far, with the code not even compiling as it is, I can't really start doing anything to it =)

Any help would be appreciated.

Report message to a moderator

Private 1st Class
Re: Compiler Problem[message #102396] Sun, 28 May 2006 22:09 Go to previous messageGo to next message
Realist

 
Messages:28
Registered:September 2005
Location: Duesseldorf, Germany
Well, the original code as it is compiles only with VC6. Porting it to VC2003 or VC2005 actually requires quite a lot of work. I've tried it myself once but gave up rather quickly.
Fortunately we don't have to re-invent the wheel since the Whitehat Project did a port to VC2003 which is also the code on which 1.13 is based on. So, if you're happy with any of these two code versions, I'd recommend using that. Someone here also provided the VC2005's project files which make it easy to upgrade the code to VC2005.
However, you will need to install Microsoft's Platform SDK, too, which brings the old header files and libraries needed to compile the code.

Report message to a moderator

Private 1st Class
Re: Compiler Problem[message #102397] Mon, 29 May 2006 01:41 Go to previous messageGo to next message
KeldorKatarn is currently offline KeldorKatarn

 
Messages:37
Registered:May 2006
Location: Germany
Quote:
Originally posted by Realist:
Porting it to VC2003 or VC2005 actually requires quite a lot of work.
Because? What are the reasons for that?

Quote:
I've tried it myself once but gave up rather quickly.
Dunno about that. Might be good training to improve my programming skills.

Quote:
Someone here also provided the VC2005's project files which make it easy to upgrade the code to VC2005.
I don't know if I'll need that. VC2005 seems to be able to import the 6.0 workspace to a 2005 projekt file very well. All the necessary include paths are automaticall added and so on. The only thing remaining is the missing older headers and some C code problems.

Quote:
However, you will need to install Microsoft's Platform SDK, too, which brings the old header files and libraries needed to compile the code.
Which I do get where?

Report message to a moderator

Private 1st Class
Re: Compiler Problem[message #102398] Mon, 29 May 2006 02:14 Go to previous messageGo to next message
Realist

 
Messages:28
Registered:September 2005
Location: Duesseldorf, Germany
Imho it's all about VC8's strictness when it comes to correct code. VC6 lets you do almost everything and Sirtech did so programming JA2. In order to do a proper upgrade you'd have to clean several hundredes of issues with each of them might be related to another number of mistakes to correct.
While absolutely doable that's really time eating, I think. But of course, do whatever you like to.

The PSDK is available here:
http://www.microsoft.com/downloads/details.aspx?familyid=D8EECD75-1FC4-49E5-BC66-9DA2B03D9B92&displaylang=en
There may be an updated version as well, but this one will work fine, too.

Report message to a moderator

Private 1st Class
Re: Compiler Problem[message #102399] Mon, 29 May 2006 23:28 Go to previous messageGo to next message
defrog is currently offline defrog

 
Messages:234
Registered:March 2004
Location: Austria
I don't recall it being difficult to compile using VS2005. Now compiling as C++ is a bit unclear. Are you trying to convert the code to C++ or just in a c++ enviroment. In the case of compiling in a c++ enviroment it shouldn't make a difference. EXCEPT for the assumptions made by c compilers. There is a big problem in the original JA2 code in that they often relied on the fact that C only has one symbol for functions and globals. In c++ there is overloading which means that functions can have identical names and need to be properly qualified using the parameters.

so to get it to work:
there are certain system headers that no longer exist as seperate headers (they were combined with other headers because they were always needed). So if you get a system header that it can't find then remove/comment out


you need to prototype functions and globals.
what this means is that globals defined in one c file but used in another needs to be added to the top of that other file example:

file1.c
int gVariable = 1;

file2.c
extern int gVariable;

this will cause the compiler to search the project for that symbol defined in another source.

function prototyping is simple...
add the function name to the beginning of the file that uses a function defined in another.
example:

file1.c
int test(int i)
{
return 0;
}

file2.c
int test(int);


Another problem is that some globals are defined in headers... BAD BAD BAD... this actually causes many instances of the same symbol in several sources, instead of a centralized variable as they intended. Once again this is because c allowed on ly 1 symbol in the tables across the sources by default.


it took me about 8 hours to get it to compile under vs2003. (maybe I'm slow)
to convert the vs2003 to vs2005 umm.. 5-10min max. Smile

Report message to a moderator

Sergeant 1st Class
Re: Compiler Problem[message #102400] Thu, 01 June 2006 07:58 Go to previous message
KeldorKatarn is currently offline KeldorKatarn

 
Messages:37
Registered:May 2006
Location: Germany
I'll see how I'll do Smile

Thanks

Report message to a moderator

Private 1st Class
Previous Topic: from scratch
Next Topic: C Programmers Wanted!
Goto Forum:
  


Current Time: Fri Jun 12 05:09:13 GMT+3 2026

Total time taken to generate the page: 0.01648 seconds