Skip to main content
Topic: Compilation problem (Windows, NOT MSVC) (Read 3308 times) previous topic - next topic

Compilation problem (Windows, NOT MSVC)

Hello !

Today I tried to compile Simutrans from sources using Open Watcom 1.8 on Windows XP (and for certain reasons do not want to go with MSVC).
Unfortunately I didn't succeed. I get an error when compiling the first of many source files. But the error happens actually inside one of the included .h files, namely log.h

I get syntax error on the line with NORETURN. Why is that thing there ? Where it is normally defined ? Am I missing some important yet-almost-obvious point ?

(From the log.h file)
Code: [Select]
    void error(const char *who, const char *format, ...);

        /**
         * writes an error into the log, aborts the program.
         * @author Hj. Malthaner
         */
        void NORETURN fatal(const char* who, const char* format, ...);


        void close();


        log_t(const char *logname, bool force_flush, bool log_debug);
        ~log_t();

Re: Compilation problem (Windows, NOT MSVC)

Reply #1
From what I was able to look up, it is evident that NORETURN is a macro (thank gods for uppercase name conventions) defined in simtypes.h somewhere after line 100, which expands to different text depending on compiler. Essentially it tells that this function will not return on stack like the normal well-behaved kind, but end program execution.

http://msdn.microsoft.com/en-us/library/k6ktzx3s(VS.80).aspx
http://unixwiz.net/techtips/gnu-c-attributes.html#noreturn

I wasn't able to find any evidence that watcom supports this syntax extension, so it might be best to follow example from
http://www.mail-archive.com/cygwin-patches@sources.redhat.com/msg01025.html
and add some glue like this:

Code: [Select]
#if defined(__WATCOMC__)
#define NORETURN
#endif

Please do note that this is only a very rough extrapolation from facts at hand - no knowledge involved at all. You'll have to fiddle a bit with these defines yourself.

Not sure if Prissi wants to support more compilers and descend into the ifdef hell, but a patch would help at least future watcomers ;)

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Re: Compilation problem (Windows, NOT MSVC)

Reply #2
Ah ! Thank you very much VS !
I just realized that I forgot how the precompiler stuff looks like in C++  :-[
Don't know why but when I found it in the simtypes.h I thought "but it's commented out" (because of the # at the beginning).

Been a while since I actually worked with C++. And I'm just trying to compile NOT on MSVC to see if the experimental simutrans version has the same random crashes on all compilers (or maybe MSVC is at fault, well... let's say I'm not a trusty person when it comes to MS products  :P )
I posted the problem here because I found the same thing in regular simutrans.

Thanks for help !

 

Re: Compilation problem (Windows, NOT MSVC)

Reply #3
I just realized that I forgot how the precompiler stuff looks like in C++  :-[
Uhm... should I try to write that for you? ;D

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Re: Compilation problem (Windows, NOT MSVC)

Reply #4
@dantedarkstar: could you please provide a patch (or something) that makes simutrans compile on your compiler?
Parsley, sage, rosemary, and maggikraut.

Re: Compilation problem (Windows, NOT MSVC)

Reply #5
If I ever make it work...  ;D
And I'm afraid I might resort to "hacks" like putting #include <stdlib.h> into the simutypes.h (which solved the problem of compiler somehow not recognizing "abs" function). So putting a sensible patch might prove tough.
All this IF I make it work in the first place.

@VS
No, thanks. I can do that. I'm not THAT bad (I hope) :D
I just didn't recognize the thing correctly when I was looking around for this NORETURN thing and when you wrote that "it's defined there" I looked again and DUH ! This is not commented out ! Precompiler stuff has "#" in C
It was just one of these moments when you look straight at something and don't see it.