Skip to content

Commit 791d4bb

Browse files
committed
Fix windows definitions
1 parent 08bd742 commit 791d4bb

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

simplecpp.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@
33
* Copyright (C) 2016-2023 simplecpp team
44
*/
55

6-
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
7-
#define SIMPLECPP_WINDOWS
8-
#define NOMINMAX
9-
#endif
6+
#include "simplecpp.h"
107

118
#ifdef SIMPLECPP_WINDOWS
12-
#define _WIN32_WINNT 0x0602
13-
#include <windows.h>
14-
#undef ERROR
9+
# define _WIN32_WINNT 0x0602
10+
# define NOMINMAX
11+
# include <windows.h>
12+
# undef ERROR
1513
#endif
1614

17-
#include "simplecpp.h"
18-
1915
#include <algorithm>
2016
#include <cassert>
2117
#include <cctype>
@@ -39,17 +35,17 @@
3935
#include <stdexcept>
4036
#include <string>
4137
#ifdef SIMPLECPP_WINDOWS
42-
#include <mutex>
38+
# include <mutex>
4339
#endif
4440
#include <unordered_map>
4541
#include <utility>
4642
#include <vector>
4743

4844
#ifdef _WIN32
49-
#include <direct.h>
45+
# include <direct.h>
5046
#else
51-
#include <sys/stat.h>
52-
#include <unistd.h>
47+
# include <sys/stat.h>
48+
# include <unistd.h>
5349
#endif
5450

5551
static bool isHex(const std::string &s)

simplecpp.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
#ifndef simplecppH
77
#define simplecppH
88

9+
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
10+
# define SIMPLECPP_WINDOWS
11+
#endif
12+
913
#include <cctype>
1014
#include <cstring>
1115
#include <iosfwd>
@@ -28,7 +32,7 @@
2832
# define SIMPLECPP_LIB
2933
#endif
3034

31-
#ifdef _WIN32
35+
#ifdef SIMPLECPP_WINDOWS
3236
# include <cstdint>
3337
#else
3438
# include <sys/stat.h>

0 commit comments

Comments
 (0)