Skip to content

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

Closed
@MHebes

Description

@MHebes

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__).

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions