Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning C4068: unknown pragma 'GCC' on MSVC/cl #2924

Closed
2 of 5 tasks
MHebes opened this issue Aug 11, 2021 · 2 comments · Fixed by #2925
Closed
2 of 5 tasks

warning C4068: unknown pragma 'GCC' on MSVC/cl #2924

MHebes opened this issue Aug 11, 2021 · 2 comments · Fixed by #2925
Assignees
Labels
confirmed kind: bug platform: visual studio related to MSVC release item: 🔨 further change solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@MHebes
Copy link

MHebes commented Aug 11, 2021

What is the issue you have?

When compiling with MSVC, The following warnings are created:

warning C4068: unknown pragma 'GCC'

Please describe the steps to reproduce the issue.

  1. Compile any program including json.hpp with cl
  2. Observe warnings

Can you provide a small but working code example?

// main.cpp
#include "nlohmann/json.hpp"

int main() { return 0; }
$ cl /EHsc main.cpp

What is the expected behavior?

No warning should appear.

And what is the actual behavior instead?

MSVC warning C4068 appears.

Which compiler and operating system are you using?

  • Compiler: cl /?, Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x86 using the Developer Command Prompt for VS 2019.
  • Operating system: Windows 10

Which version of the library did you use?

  • latest release version 3.9.1
  • other release - please state the version: ___
  • the develop branch

If you experience a compilation error: can you compile and run the unit tests?

  • yes
  • no - please copy/paste the error message below

Workaround:

Adding

#pragma warning ( disable: 4068 )

to the top of either file disables the warning, or wrap all #pragma GCC ...s in #if defined(__clang__).

@MHebes
Copy link
Author

MHebes commented Aug 11, 2021

Introduced in #2911 I believe.

@nlohmann
Copy link
Owner

I can reproduce the issue: the warnings appear in the CI, see https://github.com/nlohmann/json/runs/3300581735?check_suite_focus=true.

@nlohmann nlohmann self-assigned this Aug 11, 2021
nlohmann added a commit that referenced this issue Aug 11, 2021
@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Aug 12, 2021
@nlohmann nlohmann added this to the Release 3.9.2 milestone Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed kind: bug platform: visual studio related to MSVC release item: 🔨 further change solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants