dungeons-of-moria/umoria

Cygwin: headers.h "Unknown compiler" error

Closed this issue · 2 comments

Trying to compile the latest Umoria code in the latest Cygwin under Windows 11, I get an error:

$ make
Consolidate compiler generated dependencies of target umoria
[  1%] Building CXX object CMakeFiles/umoria.dir/src/config.cpp.o
In file included from /home/smbhax/umoria/src/config.cpp:7:
/home/smbhax/umoria/src/headers.h:28:5: error: #error "Unknown compiler"
   28 | #   error "Unknown compiler"
      |     ^~~~~
make[2]: *** [CMakeFiles/umoria.dir/build.make:76: CMakeFiles/umoria.dir/src/config.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/umoria.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

(I found I am able to avoid the error with the following crude workaround in my src/headers.h:

  • comment lines 21, 27, 28
  • add "#else" as line 22

which changes

#ifdef _WIN32
    #define _CRT_SECURE_NO_WARNINGS
    #define _CRT_NONSTDC_NO_DEPRECATE
    #define WIN32_LEAN_AND_MEAN

    #include <windows.h>

    #include <io.h>
    #include <sys/types.h>

#elif __APPLE__ ||  __linux__ || __NetBSD__ || __MORPHOS__

    #include <pwd.h>
    #include <unistd.h>
    #include <sys/param.h>

#else
#   error "Unknown compiler"
#endif

to

#ifdef _WIN32
    #define _CRT_SECURE_NO_WARNINGS
    #define _CRT_NONSTDC_NO_DEPRECATE
    #define WIN32_LEAN_AND_MEAN

    #include <windows.h>

    #include <io.h>
    #include <sys/types.h>

//#elif __APPLE__ ||  __linux__ || __NetBSD__ || __MORPHOS__
#else
    #include <pwd.h>
    #include <unistd.h>
    #include <sys/param.h>

//#else
//#   error "Unknown compiler"
#endif

)

Hi Ben, thanks for the issue. I'll take a look the next time I get a chance to test this on windows.

Hi @smbhax, unfortunately since I updated to an Arm macbook I no longer have access to Windows to be able to check this. However, commenting out those line is probably not the best approach.

As this issue has been open for a long time with no other input I will close it.