Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3

Author Topic: Atlantis PBeM - Thanks to Qwerty! (if it works)  (Read 8624 times)

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #15 on: April 05, 2010, 08:04:49 pm »

Well, after some work, maybe this phrase may be related? "pre-iso c++ headers"

I could certainly figure out what the difference is and likely update the code, if in fact that *is* the issue, but it may take time, so using a more recent version is likely a better method.

And the makefile? If you want windows batch file near-equivalent,
Code: [Select]
gcc atlantis_4_0_4\*.cpp atlantis_4_0_4\standard\*.cpp -Wno-deprecated -Iatlantis_4_0_4 -Iatlantis_4_0_4\standard 2> err04.txt
Details: This assumes it is run in the directory level one level "up" from the main code, and it sends all errors to the textfile "err04.txt", although you could use any name.

It is my opinion that batch files are always better than makefiles(since batch files can be run with a double-click, are more powerful, and if it can't do something make can, it can run make to do it for it.)
Logged
Eh?
Eh!

quinnr

  • Bay Watcher
    • View Profile
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #16 on: April 05, 2010, 08:06:45 pm »

This is a linux/UNIX shell.

BTW, would that batch file work in linux?
Logged
To exist or not exist, that is the query. For whether it is more optimal of the CPU to endure the viruses and spam of outragous fortune, or to something something something.

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #17 on: April 05, 2010, 08:13:00 pm »

Oh...

Nevermind.

Batch files are basically an automated way of sending a few commands through the windows command prompt.

Actually, remove the 2> err04.txt, and it should work fine, as it is just invoking the compiler with the near equivalent effect.


And I fixed most of the bugs with two simple words and a small change:

Fileio.h:
Code: [Select]
class ifstream;
class ofstream;

to

Code: [Select]
using namespace std;
#include <fstream>
//class ifstream;
//class ofstream;

Removing the class ifstream as it is incompatible, and using the actual header file(it should slow compile time slightly, but these days it shouldn't be a problem), and using namespace std; fixes almost all the remaining errors.

From 149 lines of errors down to 22.
Logged
Eh?
Eh!

quinnr

  • Bay Watcher
    • View Profile
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #18 on: April 05, 2010, 08:15:03 pm »

Wow really?
Are any of those 22 errors critical? (Probably, I think.)

I'll try it tonight.
Logged
To exist or not exist, that is the query. For whether it is more optimal of the CPU to endure the viruses and spam of outragous fortune, or to something something something.

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #19 on: April 05, 2010, 08:31:51 pm »

Most of it is the same error, and it will require some coding to fix.

ios::noreplace and ios::nocreate do not exist anymore, you you will probably have to add code to try opening the file first and taking action based on it.

Maybe
Code: [Select]
int fileexists(char *filename)
{
    FILE *f=fopen(filename,"r");
    if(!f)
      return 0;
    fclose(f);
    return 1;
}

Though that would be C, but the only problem there is the string type(const, string, char*, unsigned char*) as C++ both has more ways to represent a string and it actually cares about signed/unsigned.

Plus, you might need to toss in stdio.h for the C methods.

Overall, recoding it in C++ might be faster.



After that slight recoding (if(<add a ! here for noreplace>fileexists(filename))...), there will only be six(!) lines of errors left, totaling two errors.
Logged
Eh?
Eh!

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #20 on: April 05, 2010, 08:38:24 pm »

And those two errors can be solved by changing i_rand.h:
Code: [Select]
void randinit(/*_ randctx *r, word flag _*/);

void isaac(/*_ randctx *r _*/);

to

Code: [Select]
//void randinit(/*_ randctx *r, word flag _*/);
void randinit(randctx *r, word flag);

//void isaac(/*_ randctx *r _*/);
void isaac(randctx *r);

The only hard fix is manually adjusting the file opening that uses nocreate and noreplace, since those were lost with the newer standard for C++.
Logged
Eh?
Eh!

quinnr

  • Bay Watcher
    • View Profile
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #21 on: April 05, 2010, 08:40:45 pm »

Okay, I'll try to fix it tonight. Thanks!
Logged
To exist or not exist, that is the query. For whether it is more optimal of the CPU to endure the viruses and spam of outragous fortune, or to something something something.

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #22 on: April 05, 2010, 08:53:09 pm »

naturally, just as I finish fixing my own copy, 240kb of linker errors reveal themselves, although most are simply copies of each other...
Logged
Eh?
Eh!

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #23 on: April 05, 2010, 09:01:07 pm »

My mistake...

I was invoking through gcc rather than g++, so although it recognised the code as c++, it linked it as if it were C or something, so didn't understand "delete"

1.75 kb of linker errors left.
Logged
Eh?
Eh!

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #24 on: April 05, 2010, 09:16:23 pm »

246 bytes, and I don't know how to fix this, unless...

And the climatic moment is spoiled because extern "c" is not extern "C", but...

I got it to compile!

I could send you the files, since I *did* have to change a few things, but you could do it all yourself, too.
Logged
Eh?
Eh!

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #25 on: April 05, 2010, 09:22:33 pm »

This looks interesting.
Logged

quinnr

  • Bay Watcher
    • View Profile
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #26 on: April 05, 2010, 09:55:06 pm »

I know right!

And with the violent nature of Bay12'ers, it will be MORE interesting.

Also, I am telling my friends at the gameogre forums, so I expect some forum wars going on!
Logged
To exist or not exist, that is the query. For whether it is more optimal of the CPU to endure the viruses and spam of outragous fortune, or to something something something.

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #27 on: April 05, 2010, 09:59:06 pm »

Would you like to try compiling my edited set of files, or will you be fine editing your own?

I must sleep soon, so if you want them, you could get them now or in 8 hours or so.
Logged
Eh?
Eh!

quinnr

  • Bay Watcher
    • View Profile
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #28 on: April 05, 2010, 10:00:18 pm »

I'll try with yours. :D

Also, did you have to change any files in the conquest or standard folders (should have been just one of them) to make it run? If so could you tell me?
I'd just like to get a server up now, but ruleset changes in the future would be nice.
« Last Edit: April 05, 2010, 10:11:46 pm by quinnr »
Logged
To exist or not exist, that is the query. For whether it is more optimal of the CPU to endure the viruses and spam of outragous fortune, or to something something something.

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Atlantis PBeM - Need C++ Compile Help!
« Reply #29 on: April 05, 2010, 10:25:28 pm »

Nope, compiling (a copy) with a freshly extracted standard worked just fine.

Now, the only thing you will need to do specially, is -Wno-deprecated, but that is just to avoid annoyances.

Just one question:
Can you extract .zip?

I can, if I must, go get something to tar and gzip it, but it would be faster for me to just use what I already have.

If so, you can get the files here.

If the makefile doesn't work, try invoking g++ directly.
Code: [Select]
g++ atlantis_4_0_4\*.c atlantis_4_0_4\*.cpp atlantis_4_0_4\standard\*.cpp -Wno-deprecated -Iatlantis_4_0_4 -Iatlantis_4_0_4\standard
You would have to change the file paths based on the path from your current terminal directory(if you have it in the directory containing the makefile, simply use
Code: [Select]
g++ ..\*.c ..\*.cpp *.cpp -Wno-deprecated -I. -I..
In fact, that one should compile either subdirectory version.

Actually...
You might need to change the \ to /, because I know that although windows uses them interchangably, some OSs do not.
Logged
Eh?
Eh!
Pages: 1 [2] 3