agauniyal / rang

A Minimal, Header only Modern c++ library for terminal goodies 💄✨
https://agauniyal.github.io/rang/
The Unlicense
1.5k stars 144 forks source link

Fix the errors while compiling #125

Closed Abir-Tx closed 3 years ago

Abir-Tx commented 3 years ago

I got these errors while compiling my project. I used the rang.h header file. Please fix this issue if possible. I am getting these errors -

In file included from .\src\ffmpeg-coder.cpp:6:
.\lib\rang\include/rang.hpp:20:2: error: #error "Please include rang.hpp before any windows system headers or set _WIN32_WINNT at least to _WIN32_WINNT_VISTA"
   20 | #error \
      |  ^~~~~
In file included from .\src\ffmpeg-coder.cpp:6:
.\lib\rang\include/rang.hpp: In function 'bool rang::rang_implementation::isMsysPty(int)':
.\lib\rang\include/rang.hpp:180:85: error: 'GetFileInformationByHandleEx' was not declared in this scope; did you mean 'GetFileInformationByHandle'?
  180 |             const auto ptrGetFileInformationByHandleEx = reinterpret_cast<decltype(&GetFileInformationByHandleEx)>(
      |                                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                     GetFileInformationByHandle
.\lib\rang\include/rang.hpp:217:53: error: 'FileNameInfo' was not declared in this scope; did you mean 'pNameInfo'?
  217 |             if (!ptrGetFileInformationByHandleEx(h, FileNameInfo, pNameInfo.get(),
      |                                                     ^~~~~~~~~~~~
      |                                                     pNameInfo
agauniyal commented 3 years ago

The error seems to mention -

"Please include rang.hpp before any windows system headers or set _WIN32_WINNT at least to _WIN32_WINNT_VISTA"

Could you try the same? This was added by another contributor to the library so I assume it to be of some significance.

Abir-Tx commented 3 years ago

Including the header above all other header solved the problem. Thanks But can you please elaborate the second method which is setting the _WIN32_WINNT . How can I do that ?

agauniyal commented 3 years ago

@Abir-Tx maybe this'll help - https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-160

Abir-Tx commented 3 years ago

@Abir-Tx maybe this'll help - https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-160

Okay, Thanks a lot for the help brother . ❤ Solved my issue real quick.