#include <> or #include ""?

Answered

Hi,

CLion is suggesting adding include files whenever I use a type that hasn't been included.

The problem is that it generates an include using <> instead of "", which I feel is wrong.

<> is used for system files or similar, while "" is used for my project files.

I think it was said that the way CLion determines this is that if the header file is known because cmake uses INCLUDE_DIRECTORIES then CLion considers it a system file. I don't think that is right.

If that indeed is the way to determine whether to use <> or "" then what way should I use to include my sub-projects?

A long time ago I tried using -iquote I think it was, but that didn't work well.

2 comments
Comment actions Permalink

I'll add, I still use the feature, but I always have to go up and change the <> to "".

When I think about it, I think I _never_ have a case where I get an include for system files. Like if I use std::string, I never get the suggestion to include <string>. I always have to add those manually.

I'm on gcc 7.1, but I think it has been a problem since I was using 4.7.

 

 

0
Comment actions Permalink

We have a feature request in our tracker already: https://youtrack.jetbrains.com/issue/CPP-8387. Feel free to comment or upvote and sorry for the inconvenience.

0

Please sign in to leave a comment.