Need help porting an old mud to visual studio

Posted by Jparker on Wed 01 Feb 2006 12:39 AM — 10 posts, 30,599 views.

#0
It's the darndest thing... I have this code for a mud some friends of mine have worked on for some 10+ years. It's a rom derivative. I have a working copy of your rom code that works fine. I've gone down through the differnces list, and it all looks fine.

The one compile error that has me absolutly stumped...

src\merc.h(72): error C2632: 'char' followed by 'bool' is illegal

Under the "#if defined(_AIX)". See, it really bugs me because I have the exact same line of code in the regular rom code, and it compiles without so much as a warning.

I hope you can offer some insight, I haven't been able to figure out why it works for one but not the other. I suspect it may have something to do with the color code loaded into the old mud.

USA #1
Are both being compiled under Visual Studio? Are both being compiled using the same MSVC compiler mode (i.e. C and C++).

What is probably the case is that one is being compiled using C mode, and the one with the error is being compiled using C++ mode. In C++ it is illegal to have bool after char, because both are built-in, reserved type keywords.
#2
The settings should be identical. I took the sln file from the win32 server files provided here, which compile perfectly, and updated it with the differnt .c and .h files.

In theory, they're being compiled identically unless there is a setting I am missing somewhere.
#3
Im begining to think you are right, but I don't suppose that there is a list of VS settings used for the win32 server files to go along with the differences list?
USA #4
There'd be a number of places to look. For one, in the project settings, you should be able to set the language rules being used. Also, the file extensions are very important, but I suspect that you're using .c and not .cpp, .cx, or .cc.

Another place to look is the individual file compile settings.



Finally, I suggest you try the following. Try putting an "int class" somewhere - for instance, in mud.h right before the problem line, and see if it compiles. If you are using C++, it will fail because class is also a reserved word. If you're using C, it will not fail.

And if none of this works, please post the part from mud.h that's causing the trouble.
#5
Ok... I've managed to get further, I believe, with your insights. One more error...

Rom error LNK2019: unresolved external symbol __imp__pthread_create referenced in function _init_descriptor

I believe its the last thing left. I have pthread.h in my include folder, so I'm not sure where to look for this now.
USA #6
You need to have a pthread library linked into your executable. Link errors occur after compilation, so the include files are no longer relevant.

Is pthread support something your friends added?

In any case you'll probably need to get a copy of the pthread library. See: http://sourceware.org/pthreads-win32/

If you don't know how to link stuff in and all that, just let me know and we'll work through it.
#7
/*Well, I got it to get all the way through compiling, but running the program doesn't seem to output anything in the console. Could this be due to the included pthread file, or should i look somewhere else? I checked the windif file several times, so I'm reasonably sure i didnt miss any of that, just looking for leads now. */



Fixed that problem, it actually starts up now! Sorta... Get some bad vnum errors, but Im sure I can weed those out given enough time.

Thanks for the insights.
Amended on Wed 01 Feb 2006 09:03 PM by Jparker
USA #8
Glad to hear you've got it all set up and running. Things do sometimes behave oddly on Windows, what with different underlying console models and all that.

Bad vnum errors are also sometimes normal; I know that my MUD barfs a whole bunch out at boot because some areas are loaded before others, but they have cross-references.
#9
All right! I got it!

Thank you very much, and thank Gammon for providing me with a site that I've used for quite a while, mucking with rom code.