Warren  P Warren P - 1 month ago 19
C++ Question

Why does Kdevelop 4 show my source cpp files twice in the project?

I am using KDevelop 4.7.1 on OpenSUSE Leap Linux, and I'm trying to figure out why both the main.cpp and test.cpp files are shown TWICE in my project, once in the root note and once inside the launch configuration.

I am aware that the test inside the test below is a launchable executable but what I don't understand, besides why anyone would want this, is how can I hide the duplication (other than just closing the tree view) or even completely hide the launch configuration node since it seems useless and confusing. Did I make a mistake when making this project able to launch? I just created a new Qt project, tried to build and execute it. Other IDEs, even earlier KDevelop versions, I think, did not show all my files twice like this.

If there is a configuration option in kdevelop that will just hide the launch targets, since I only ever want to have one, that would be great, or any option that can hide the .cpp files so they don't appear under the launch configuration, I'd like to know how to do that.

kdev 4

Answer

The highlighted "Test" comes from the CMake target defined. In Your CMakeLists.txt you have something like

add_executable(test main.cpp test.cpp)

So the inner "Test" only shows the sources files related to this target.