can't resolve included libraries

Hello,
I'm using Clion on Linux (Arch), I've made a CMakeList for my project which compiles and runs without any issues but Clion doesn't seem to resolve any included system library (SDL, OpenGL, Glfw, Bullet Physics..)
It gives many errors on the project.
The same happens with a default "hello world" project, it cannot see <iostream> library.
Any idea aboiuit what coiuld be causing this?
Im really willing to use this IDE as I really liked PyCharm interface, and was looking for a nice interface for c+++,
Regards,

0
15 comments

Could you check please that the Settings | Build, Execution, Deployment | Toolchains Check Environment test doesn't get any issues and problems?
Attach a screen shot please for us to see the toolchain you are using.

0
Avatar
Permanently deleted user

thanks for quick reply, here is screenshot for default helloworld project, automatically configured by Clion,
No problems on toolchain, everything green,
Just note that I changed it from default included with Clion to see if it solved problems but was the same with default...

Also don't know if matters, but I installed Clion by unzipping latest EAP in one partition of my disk which is not the same as system is running .. but don't think this could be the origin, as I was doing the same with Eclipse and never had problems,



Attachment(s):
snapshot_clion.png
0

You are using your custom CMake, that is 3.0.2 version, not supported by the CLion yet.
Please, use bundled version instead, may be this is the source of the problem in your case.

0
Avatar
Permanently deleted user

No this isn't the cause, as I mentionned before, I had already this problem with default included version of cmake (in fact I switched to see if it changed anything).
I attached another screenshot which shows the problem still happens with default settings,
Regards,



Attachment(s):
snapshot_clion_2.png
0
Avatar
Permanently deleted user

I have a similar issue and am using the default cmake.

I've enclosed the screen shots. The fist shows that the "JuceHeader.h" file is greyed out, yet the file is included in Main.cpp and it is listed in the CMakeLists.txt file.

The CMakeList file actually tries to list every file in the project so that it would be treated as part of the project even if it is not included in the Main.cpp include tree.



Attachment(s):
CLion-Cap-2.tiff
CLion-Cap-1.tiff
0

Does this HEADER_FILES macro is used then in something like:

add_library(lib_name STATIC ${SOURCE_FILES} ${HEADER_FILES})

or

add_executable(exec_name ${SOURCE_FILES} ${HEADER_FILES})
 
?
0

We have two suggestions for you here:
1. First, it happens because of this issue (http://youtrack.jetbrains.com/issue/CPP-740) but this is only why the bundled GDB can't be found.
2. Second problem is that you maybe have standard includes not in the place where CMake looks for them. Could you build this Hello world program from the console? And from the CLion?

0
Avatar
Permanently deleted user

Hi,
I have no problem with the building, just the inclusion is not working is the editor and report many errors marked in red.
You can see on the following screenshot when you hover the line including <iostream>  it shows: "canno't find iostream" as well as the red marks on the right..
Also on the console output yoiu see the project build and run fine!
This is possible CMake is not looking at the right emplacement but AFAIK, libs are located in the standard places:

as an example a simple: 'locate iostream' returns:
/usr/include/c++/4.9.1/iostream

OTOH Eclipse automatically finds it



Attachment(s):
snapshot_clion_3.png
0

Ok, got it. Looks like this is the same as here: https://youtrack.jetbrains.com/issue/CPP-170#comment=27-795371

Check the workaround there. Does it help?

0
Avatar
Permanently deleted user

My mistake, I did not add the ${HEADER_FILES} to add_executable().

Thanks! Problem solved.

0
Avatar
Permanently deleted user

Yep this was exactly the problem I was facing.
using "LANG=en_US.UTF-8" fixed the issue! and now works like a charm :)
Thanks for your help, hope you'll make Clion available at reasonable price because really like the editor so far.

Also FYI, i was having the issue on Arch districution, which is the same as the person who opened the bug on the link you provided.

0
Avatar
Permanently deleted user

Hi, I recently had this same problem and just wanted to add for future viewers that if you're on Windows, and a compiler hasn't come bundled with your set-up, you might have had to install one separately. After doing so, you should close and re-open CLion and this might resolve your problem. 

0
Avatar
Permanently deleted user

This happens when accessing an include path which is symlinked from another path in the project where the symlinked one is the one used in CMake for example.

In MXNet:

 

include/nvvm is a symbolic link to 3rdparty/tvm....    when opening the same header via the 3rdparty path, no standard headers are resolved. When opening through include/nvvm which is also the path used in CMake it works as expected.

https://github.com/apache/incubator-mxnet

0

@Pedro Larroy, thanks for your note! It might be related to https://youtrack.jetbrains.com/issue/CPP-15438 and the related issues. Feel free to comment or upvote.

0

I believe I just found this problem to be caused by a plugin. What I had done just before the standard libraries were found again was I uninstalled a plugin (monkey king) and explicitly set the C++ compiler to g++. At some point after doing both these it started finding the files.

0

Please sign in to leave a comment.