CLion not recognizing method names from #includes

I am using CLion for a couple of days for my project.

Suddenly CLion stopped to recognize some method names from #includes and marked some includes as "unused import statements".
In fact, they are used, and they are for those methods that are now unrecognized.

However, projects builds fine.

Example below.


Same file:


#include <signal.h>   // marked as grey (unused import statement)


....
  signal(SIGHUP, SIG_IGN);   // marked as red (can't resolve variable 'signal')


Why could that be and how to fix?

Thanks,
Max

0

Hi Max.

Could you please specify how to setup include paths in CMakeLists.txt?

0
Avatar
Permanently deleted user

Hi Anna,

But CMakeLists are configured correctly, and moreover, in another c++ file, the same std methods are recognized correctly. So it's issue for just one cpp file.

0

Hi Max.

Could you please share your project (you can send it to clion-support at jetbrains.com) or attach a sample project so we can take a look at what is going on?

0
Avatar
Permanently deleted user

Sorry Anna,

I realised this file was C file, not C++.
And that file which was "good" was .cpp
I think that's why includes were not recognized in this .c file.

Regarding the fact that it is C language now... Is there any possibility to make these C lines colorful in CLion?

Thanks,
Max

0

Hi Max.

C is supported by CLion, so it should work out of the box.
Could you please try to isolate the problem and share a sample project with us?

0
Avatar
Permanently deleted user

Hi Anna,

Yes I will try to do this, thanks.

-Max

0
Avatar
Permanently deleted user

Hello,

Problem is solved:

In file CMakeLists.txt I changed:

set_source_files_properties(xmppgw.c PROPERTIES COMPILE_FLAGS "-x c++")

for

set_source_files_properties(xmppgw.c PROPERTIES LANGUAGE CXX)

And it worked like a charm.

Thanks for help!

Max

0

请先登录再写评论。