Optimize Imports Stripping Out Required Headers
已回答
Hi,
I've been trying to use optimize imports to clean up a sizeable codebase, but on many files required headers get removed and break the build. I can't find any pattern in what gets removed. I've also tried to run it on individual modules with similar results. Is there a way to fix this or is the import optimization tool just broken?
Thanks for the help,
Tom
请先登录再写评论。
Hello! Is your project C or C++? What CLion version do you use?
Hi Anna,
My project is C++. I am currently using the most up to date version, 2018.2.4.
Tom
Is your project a CMake-based?
We have a regression in Optimize Imports, but it's about C projects - https://youtrack.jetbrains.com/issue/CPP-13852. So in order to investigate the issue you've faced, we need to reproduce it on our side. We kindly ask you to create a simple sample project with which the issue can be reproduced and send it to clion-support at jetbrains.com. Thanks!
Anna,
My project is cmake based. I'm not sure that I can create a sample project for this problem because I can't identify any pattern in the decision making for import optimization. I don't know what example to create which will re-create the problem. But I can tell that if you have a complex project using cmake and cpp files there's a good chance that running optimize imports on it will break the build, just as the C projects issue you pointed me to does.
I'm afraid, we can't do much without reproducing (and since we don't have similar issues reported). The responsible developer is investigating https://youtrack.jetbrains.com/issue/CPP-13852 right now. Let's wait and see whether the fix will help in your case too.