Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-isystem for MS Visual Studio C++ Compiler

I usually like to have a lot of warnings enabled when programming. However, some libraries contains code that easily causes warnings (.., python, Qt, ..). When compiling with gcc I can just use -isystem instead of -I to silence that. How can I do the same with the MS compiler? I know of the warning #pragma, but I would like a solution that does not involve compiler specific code all over the place. I also know that I can turn off specific warnings, but that is not what I want either.

BTW: isystem should be a tag of this question, but I was not allowed to do that..

SUMMARY: I want to see all warnings from my code, and no warnings from external code.

like image 918
Mathias Avatar asked Nov 16 '09 12:11

Mathias


People also ask

Does Visual Studio have a compiler for C?

The Visual Studio build tools include a C compiler that you can use to create everything from basic console programs to full Windows Desktop applications, mobile apps, and more.

What compiler does Microsoft Visual Studio use?

The C/C++ compiler in Visual Studio is and always has been Microsoft C++ Compiler, built by Microsoft (not based on anything else.)

How do I use compile C code in Visual Studio?

After stopping the C file, go & click the File button at the top left corner of the Visual Studio Code Editor, and select the Settings via Preferences, as shown below image. After clicking the Settings, it shows the image below. In this image, select the extension button to set the settings for the C Compiler.


1 Answers

As of 2017-08-17 this still seems impossible.

I added a feature request here:

https://developercommunity.visualstudio.com/content/problem/96411/impossible-to-ignore-warnings-from-system-librarie.html

Update 2018:

The issue is now closed as fixed and is available in the standard MS VS installation [source]. A blog post from the MS team goes through the new features [here].

The solution from MS is flexible. You can not only differentiate using paths like you do with --isystem, but for example also by whether you use #include "" or #include <>. The blog post is worth a read to see all the various customization points.

like image 57
Mathias Avatar answered Nov 16 '22 02:11

Mathias