Registered Member
|
I want to use KDevelop for C++ but I keep having these problems with the parser that won't find some includes or sometimes will find them but won't recognize it if I use a class from them.
Examples:
In Open configuration > Language support, I tried to add /usr/include/c++/5. Doing that, I can hover over #include <string> and have the correct infos, but I still get the errors with using std::string (or declaring an std::string variable). This is a CMake project, here is my CMakeLists.txt if that's relevant, it's quite basic:
Interestingly, with the exact same project that I imported from Qt Creator, KDevelop seems to find all the includes on its own. I don't really want to go back to Qt Creator, but at least it works... |
Global Moderator
|
Hello!
Did you import your project in KDevelop as a cmake project? Make sure you did that -- otherwise KDevelop can't figure out the include paths. Try closing the project, then use Open/Import project again and make sure "CMake project manager" is selected. Greetings, Sven
I'm working on the KDevelop IDE.
|
Registered Member
|
Thank you for your help. I did import the project with Open / Import. Just to be sure, I retried closing and reimporting with CMake project manager but the problem is still here.
EDIT: Here is a test I just did: Create a new project > Project type: Terminal CMake C++ > Finish > Leave everything default in the CMake configuration windows that appear > OK. In this new hello world project, KDevelop can't find #include <iostream>. |
Registered Member
|
|
Global Moderator
|
This was broken starting from clang 5.0 and it is fixed with current master. You can either use kdevelop from the 5.2 or master branch, or download the AppImage from kdevelop.org/download which ships a version of clang it works with properly, in case you want to go back to KDevelop.
I'm working on the KDevelop IDE.
|
Global Moderator
|
On second thought, maybe this is a different issue from what was fixed recently ... I'm not sure. Which version of KDevelop do you use, and where from? Did you try with the AppImage?
I'm working on the KDevelop IDE.
|
Registered Member
|
I have the same problem under chakra linux, since kdevelop 5.2. clang version is 4.0.1. I see that kdevelop doesn't find my includes, like #include <iostream> or #include <string>. If I point kdevelop to /usr/include/c++/6.3.1/ for example, I see the files, but still std::string or std::cout or whatever doesn't work.
|
Global Moderator
|
Can you go to your project settings, and under Language support -> C/C++ Parser select a different value in the "Compiler for path" combobox? Does that change anything?
I'm working on the KDevelop IDE.
|
Registered Member
|
Yep, that worked! Changing clang for GCC worked.
Thanks! |
Global Moderator
|
Sorry, does it work with "clang" selected or with "gcc" selected? Just to be sure.
I'm working on the KDevelop IDE.
|
Registered Member
|
It works with GCC selected.
|
Registered users: Bing [Bot], daret, Google [Bot], Sogou [Bot]