How to make CLion find header files?

已完成

Hi,

I have a C project that was originally some other IDE project.
All #includes are without full path to the header file, but use simple filename instead.
I see them in red with an error message 'Cannot find someheaderfile.h' and I cannot do 'Find Usages' or 'Go to declaration'.

This is when I mark the root sources directory with 'Mark Directory as Project Sources and Headers'. When I unmark this one, I get all #includes in green, but I still cannot follow any references and I also have "This file does not belong to any project target, code insight features might not work properly" warning message.

I tried to add different directories to include_directories() in CMakeLists.txt, but that doesn't seem to work.

Could you please advise what I can do to browse the source code? I do not need (and probably couldn't) build this code. What I need is to use those two navigation features I mentioned.


Thanks,
Mike

1

Completed by email.

In short: 1) CLion is able to work only with CMake projects yet. All files should be added to the target otherwise CLion can't understand them correctly. 2) In order to use #include without full path to the header file you need to specify a header search path in your CMakeLists.txt by adding include_directories.

1

I have all sorts of include_directories() in the cmake files and it still can't find 80% of the files. I think for large projects, everything just goes to pieces.  I am really losing it with this product now.

0

@Cjolivier01if your CMake project is configured and loaded correctly, CLion should be able to find files. Was this project based on CMake originally or was it converted from some other build system? Do you build locally or do you use the full remote mode?

0

It is my cmake file.  Does the header resolution care about which project is selected?

I literally try hard-coding the path into add_include_directories() and makes no difference.

It seems to randomly find some and not others and seems horribly confused by symbolic links.

0

@Cjolivier01 Do you build locally or do you use the full remote mode?

0

This project is way too big to work remote in the way that these IDEs do it.  The symbolic links confuse the remote development system.

0

created a year ago....

0

I have been sitting here for 15 minutes waiting on "Refreshing files" so I can start another build. This is ridiculous. More often than not, I have to pkill -9 java and just restart. I dont know what its doing, and quite frankly, I don't care,  but STOP IT

0

all day just REFRESHING FILES

this has been a problem for years and its getting steadily worse

0

gave up, pkill -9 java. this is retarded

0

Cjolivier01 we would be very grateful if you could call File | Reload All from Disk and let us know how much time it takes to complete this process on your side.

0

请先登录再写评论。