mattiasgustavsson / dos-like

Engine for making things with a MS-DOS feel, but for modern platforms
Other
1k stars 49 forks source link

WIN32_LEAN_AND_MEAN causes errors #19

Closed RicoP closed 3 years ago

RicoP commented 3 years ago
#define WIN32_LEAN_AND_MEAN
#define DOS_IMPLEMENTATION
#include "dos.h"

results in

R:\dos-like-3D\include\libs/app.h(2051): error C2065: 'TIMECAPS': undeclared identifier
R:\dos-like-3D\include\libs/app.h(2051): error C2146: syntax error: missing ';' before identifier 'tc'
R:\dos-like-3D\include\libs/app.h(2051): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/app.h(2052): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/app.h(2052): error C2065: 'TIMECAPS': undeclared identifier
R:\dos-like-3D\include\libs/app.h(2052): error C3861: 'timeGetDevCaps': identifier not found
R:\dos-like-3D\include\libs/app.h(2052): error C2065: 'TIMERR_NOERROR': undeclared identifier
R:\dos-like-3D\include\libs/app.h(2053): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/app.h(2053): error C3861: 'timeBeginPeriod': identifier not found
R:\dos-like-3D\include\libs/app.h(2392): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/app.h(2392): error C2065: 'TIMECAPS': undeclared identifier
R:\dos-like-3D\include\libs/app.h(2392): error C3861: 'timeGetDevCaps': identifier not found
R:\dos-like-3D\include\libs/app.h(2392): error C2065: 'TIMERR_NOERROR': undeclared identifier
R:\dos-like-3D\include\libs/app.h(2393): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/app.h(2393): error C3861: 'timeEndPeriod': identifier not found
R:\dos-like-3D\include\libs/frametimer.h(104): error C2065: 'TIMECAPS': undeclared identifier
R:\dos-like-3D\include\libs/frametimer.h(104): error C2146: syntax error: missing ';' before identifier 'tc'
R:\dos-like-3D\include\libs/frametimer.h(104): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/frametimer.h(105): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/frametimer.h(105): error C2065: 'TIMECAPS': undeclared identifier
R:\dos-like-3D\include\libs/frametimer.h(105): error C3861: 'timeGetDevCaps': identifier not found
R:\dos-like-3D\include\libs/frametimer.h(105): error C2065: 'TIMERR_NOERROR': undeclared identifier
R:\dos-like-3D\include\libs/frametimer.h(106): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/frametimer.h(106): error C3861: 'timeBeginPeriod': identifier not found
R:\dos-like-3D\include\libs/frametimer.h(133): error C2065: 'TIMECAPS': undeclared identifier
R:\dos-like-3D\include\libs/frametimer.h(133): error C2146: syntax error: missing ';' before identifier 'tc'
R:\dos-like-3D\include\libs/frametimer.h(133): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/frametimer.h(134): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/frametimer.h(134): error C2065: 'TIMECAPS': undeclared identifier
R:\dos-like-3D\include\libs/frametimer.h(134): error C3861: 'timeGetDevCaps': identifier not found
R:\dos-like-3D\include\libs/frametimer.h(134): error C2065: 'TIMERR_NOERROR': undeclared identifier
R:\dos-like-3D\include\libs/frametimer.h(135): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/frametimer.h(135): error C3861: 'timeEndPeriod': identifier not found
R:\dos-like-3D\include\libs/thread.h(1219): error C2065: 'TIMECAPS': undeclared identifier
R:\dos-like-3D\include\libs/thread.h(1219): error C2146: syntax error: missing ';' before identifier 'tc'
R:\dos-like-3D\include\libs/thread.h(1219): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/thread.h(1220): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/thread.h(1220): error C2065: 'TIMECAPS': undeclared identifier
R:\dos-like-3D\include\libs/thread.h(1220): error C3861: 'timeGetDevCaps': identifier not found
R:\dos-like-3D\include\libs/thread.h(1220): error C2065: 'TIMERR_NOERROR': undeclared identifier
R:\dos-like-3D\include\libs/thread.h(1221): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/thread.h(1221): error C3861: 'timeBeginPeriod': identifier not found
R:\dos-like-3D\include\libs/thread.h(1243): error C2065: 'TIMECAPS': undeclared identifier
R:\dos-like-3D\include\libs/thread.h(1243): error C2146: syntax error: missing ';' before identifier 'tc'
R:\dos-like-3D\include\libs/thread.h(1243): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/thread.h(1244): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/thread.h(1244): error C2065: 'TIMECAPS': undeclared identifier
R:\dos-like-3D\include\libs/thread.h(1244): error C3861: 'timeGetDevCaps': identifier not found
R:\dos-like-3D\include\libs/thread.h(1244): error C2065: 'TIMERR_NOERROR': undeclared identifier
R:\dos-like-3D\include\libs/thread.h(1245): error C2065: 'tc': undeclared identifier
R:\dos-like-3D\include\libs/thread.h(1245): error C3861: 'timeEndPeriod': identifier not found

I use the WIN32_LEAN_AND_MEAN define globally and it would be nice if dos.h could handle that.

mattiasgustavsson commented 3 years ago

I don’t think that will be possible, the leanandmean flag is used to strip away some headers from the windows.h file, and my code needs some of those symbols. As a workaround, I suggest putting an #undef WIN32_LEAN_AND_MEAN at the top of your dos.c file.

Personally, I find that using WIN32_LEAN_AND_MEAN, while useful in the past, does not make much of a difference these days - last time I checked, the difference in compile time was negligible.