15 Jun, 2007, atrofast wrote in the 1st comment:
Votes: 0
Greetings everybody,

I'm trying to compile ROM using g++ so I can make use of some OO functionality. While it compiles it crashes once I boot it.
Program received signal SIGSEGV, Segmentation fault.
get_room_index__Fi (vnum=3502) at db.c:2821
2821 if ( pRoomIndex->vnum == vnum )
(gdb) bt
#0 get_room_index__Fi (vnum=3502) at db.c:2821
#1 0x0807047c in fix_exits__Fv () at db.c:1631
#2 0x0806eb46 in boot_db__Fv () at db.c:540
#3 0x08069202 in main (argc=2, argv=0xbffffc94) at comm.c:425
#4 0x4007f54d in __libc_start_main () from /lib/libc.so.6

I can't figure out why it crashes there. Has anybody written a guide to how to convert ROM to be g++ compatible? I'm a good programmer when it comes to languages such as Java and VB.Net, I've never really worked with C++ and g++ so I understand there is a learning curve.

15 Jun, 2007, Davion wrote in the 2nd comment:
Votes: 0
Don't really have a guide, but I have ROM converted to use g++ already. Check it out, maybe run a diff with yours to see where you went wrong.
15 Jun, 2007, Ugha wrote in the 3rd comment:
Votes: 0
I'm no C++ expert, but I'm just curious… are you sure room 3502 exists? Have you modified the area.lst?
15 Jun, 2007, atrofast wrote in the 4th comment:
Votes: 0
Yes the room exists… There has been no modifications to the areas and when compiled with gcc it works just fine.
I'm getting the g++ version of ROM thanks for the quick posts!

15 Jun, 2007, Justice wrote in the 5th comment:
Votes: 0
Just wondering, have you converted room_index_data into a class? I've noticed that with C++ alot of pointers initialize to a value other than NULL. In this case, the null check will pass, but the code will crash when you try to access a member.
16 Jun, 2007, atrofast wrote in the 6th comment:
Votes: 0
No I never did, however comparing to the source linked above I could make it work… However I had to include <crypt.h> otherwise the crypt wouldn't work. But now it seems to be running fine, thanks for all the help guys!

16 Jun, 2007, Guest wrote in the 7th comment:
Votes: 0
There may have been some other problem at the time of the crash. It's usually a good idea to try and use GDB to figure out what might have happened.

Depending on how things worked out, pRoomIndex might not have been properly allocated and you were checking a junk pointer when it crashed. We're sort of left to assume you made no modifications to the code other than fixing compiler errors/warnings.