Cygwin: headers.h "Unknown compiler" error
Closed this issue · 2 comments
smbhax commented
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
)
mrcook commented
Hi Ben, thanks for the issue. I'll take a look the next time I get a chance to test this on windows.