PDA

View Full Version : WOOT ! World compiling with gcc 3.2.1


Trumpcard
11-21-2002, 01:54 AM
Im pumped, got it compiling..

Heres how I worked through it..

First, alot of the messages are warnings, so I filtered out the ones I didnt want to see by removing -Waggregate-returns from the makefile, and added -Wno-deprecated so I wouldnt have so much crap to look at..

At that point, the 1st issue.
packet_dump.cpp and packet_dump.h.

3.2 did not like the header file defining default arguments in the function prototype, then defining them again in the function call iteself in .cpp, so in packet_dump.h I changed this..

//void DumpPacketAscii(uchar* buf, int32 size, int32 cols=16, int32
void DumpPacketAscii(uchar* buf, int32 size, int32 cols, int32 skip);
//void DumpPacketHex(uchar* buf, int32 size, int32 cols=16, int32 s
void DumpPacketHex(uchar* buf, int32 size, int32 cols, int32 skip);


Ok, that gets us further.. Next are namespace problems..

ALL hex and dec calls need to be prefixed with std::

so in console.cpp and zoneserver.cpp, I added the namespaces to the beginning of those calls (maybe in packet too).

va functions missing.

Easy enough,
add
#include <stdarg.h> into the else section after the win32 ifdef
that way for linux, you'll get the extra include.
Put this in console.cpp and zoneserver.cpp.

I think that was it, world compiled !

Im at work , so I can test my new world binary out, but looking forward to trying it. Next will be zone, and I bet it will be alot tougher.

If it works properly tonght, I'll send my changes to image to get him to roll them into the code and then start working on zone.

The big confusion was coming from the million and one deprecated header messages (which I'll work on fixing also), and the aggregate return messages. Once those got filtered out, it really wasnt that hard to run the problems down.

Update: The problem child in zone appears to be packet_dump_file.cpp.

neotokyo
11-21-2002, 02:14 AM
ANSI C++ requires you to define default values ONLY in the declaration and not in the definition of a function!!!!!

change that back trump, and remove the default value at the definition

Trumpcard
11-21-2002, 02:17 AM
Glad someone knows the ANSI standards! I sure don't !

Thanks Neo!
Actually, going back, it looks like it was changed in 3.12 packet_dump.cpp, I was testing with 3.11.

Now Im at here in zone..

In file included from net.cpp:78:
../common/unix.h:32:7: warning: no newline at end of file
net.cpp: In function `void LoadSPDat()':
net.cpp:369: `nocreate' is not a member of type `std::basic_ios<char, std::char
traits<char> >'
net.cpp:369: `openprot' is not a member of type `std::basic_filebuf<char, std::
har_traits<char> >'
make: *** [net.o] Error 1

Trumpcard
11-21-2002, 03:22 AM
Ahhh...

ANSI finalized the C++ standard and decided that iostreams should not have a nocreate flag since it is platform dependent. Therefore the use of it is either non-existent or not dependable.

Heres from gcc.org
there is no ios::nocreate/ios::noreplace in ISO 14882
I have seen ios::nocreate being used for input-streams, most probably because the author thought it would be more correct to specify nocreate "explicitly". So you can simply leave it out for input-streams.

For output streams, "nocreate" is probably the default, unless you specify std::ios::trunc ? To be safe, you can open the file for reading, check if it has been opened, and then decide whether you want to create/replace or not. To my knowledge, even older implementations support app, ate and trunc (except for app ?).