CLion fails to find header files in path

Completed

I have a project with this structure:

root
|-- src
   |-- phys
      |-- common
           |-- common.hpp
           |-- ...
        |-- ...
    |-- ...
|-- tests
    |-- client.cpp
    |-- ...

client.cpp has:

#include <set>
#include "phys/common/common.hpp"

to which CLion emits errors:

'set' file not found
'phys/common/common.hpp' file not found

Regarding set, I also have "#include <set>" inside files in src, e.g., src/phys/common/common.hpp, where CLion detects it well and allows autocompletion, etc.

Regarding the second error ('phys/common/common.hpp' file not found), here's what puzzles me: In client.cpp I use classes declared in common.hpp, and CLion doesn't detect them but suggests fixes in the context actions in the vain of:
"Import class Foo from ../src/phys/common/common.hpp ?"

needless to say the project compiles well.

What am I doing wrong?

 

CMakeLists.txt has:

include_directories(src tests utils ...)

 

0
4 comments

Hello!

Is client.cpp included into the project in CMakeLists.txt?

0
Avatar
Permanently deleted user

yes, this is from CMakeLists.txt:

file(GLOB_RECURSE SOURCE_FILES src/*.cpp src/*.hpp src/*.c src/*.h tests/*.cpp tests/*.hpp)

(and client.cpp is in tests)

0
Avatar
Permanently deleted user

ah, I think I found the problem, there was a line in CmakeLists:

list(FILTER SOURCE_FILES EXCLUDE REGEX "client")
0

I'm glad you solved the issue!

0

Please sign in to leave a comment.