1

I want to do the same as this guy and suppress warnings for third-party source code. I presume the same answer of using -isystem will work just fine, but how can I specify this in Eclipse?

All I see is this, with no option to alter the -I switch:

enter image description here

Community
  • 1
  • 1
Ed King
  • 1,833
  • 1
  • 15
  • 32

1 Answers1

1

In Eclipse, the Includes section of your compiler settings shown in your screenshot only allows you to set paths using the -I or -include options.

To suppress warnings for third-party source code, you can indeed use -isystem to treat them as system includes, but you will have to add the relevant includes as Other flags in the Miscellaneous section of your compiler settings.

For instance, using Eclipse Mars, you may want to do something similar to the following:

Overview of isystem compilaer flag in Eclipse

Pyves
  • 6,333
  • 7
  • 41
  • 59
  • 1
    Thanks for the information. I'll try this out and get back to you! – Ed King Apr 22 '17 at 10:06
  • Unfortunately this didn't work. I'm not sure whether this is because I have a mix of C and C++ code. The third-party source tree has many folders, so if I have to specify each and every folder that's not manageable either. Any further suggestions, save for just disabling the warnings globally? – Ed King Apr 24 '17 at 14:57
  • @EdKing: strange, it seemed to work fine when I gave it a go before posting the answer. Have you removed the includes managed by `isystem` in Miscellaneous from the Includes sections of the compilers in Eclipse? In the console output, do you actually see the correct parameters being used when the compiler is building your project? – Pyves Apr 24 '17 at 17:25
  • I had a go a number of ways. When I tried what you just mentioned, I got immediate errors concerning templates being specified with C linkage, which didn't make much sense, so I definitely think the option confuses Eclipse in some way. – Ed King Apr 25 '17 at 08:21
  • Strange. Do you have a minimal example to reproduce the problem? – Pyves Apr 25 '17 at 08:44
  • 1
    Unfortunately not. I'll park this for now and retry when I've stripped back the source - they use a lot of `#pragma once` directives rather than include guards, in addition to naming files the same thing in different folders, which seems like it could confuse matters. I'll accept your answer anyway and edit it when I find out more, as I think your method is correct. Thanks for your help. – Ed King Apr 25 '17 at 09:10