Element not in project

I am getting a lot of "element not in project" or if I am trying to implement a function from the class I get "These files do not belong to the project" pop up.

A bit of info about the project:

1. It uses a global CMakeLists.txt and then sub cmakes.  So the part I am editing would be under the api/ subproject.
2. The class I am editing is indeed part of the project
3. The class is encompassed by a namespace
4. I have tried opening the subproject cmake directly and it says the same thing.

I am posting the cmakelists for the api project and the header code.  This happens with all the classes in my projects.

namespace API

cmake_minimum_required(VERSION 2.8.11) project(mcm-mobile-api) include_directories(         ${CURL_INCLUDE_DIR}         ../rapidjson/include         ./         ./src         ) add_library(${PROJECT_NAME} STATIC         src/mcminterface.cpp         src/securitytoken.cpp         src/error.cpp         src/curlheader.cpp         src/curlhandler.cpp         src/transaction.cpp         src/customer.cpp         src/creditcard.cpp         )

All the classes in the above say it's not part of the project.

One thing I noticed at one point was when clicking "add new cpp class" it prompts for a project to add the class to and they are all listed as ${PROJECT_NAME} instead of the parsed out project name from cmake.  Bug maybe?  Maybe this is causing the issues though.

Now in the above code example I added the void xxx() and hit alt+insert, chose Implement Functions and then it will warn me it's not in the project after I choose xxx from the popup to implement.

Any ideas?  Should I bug this?


I just noticed that CLion doesn't handle symlinks very well.  This may be causing the issue.

When I went to a symbol it opened a new file at the hard link path rather than the relative sym linked path.

My project has the following directory:


My symlink is:

source -> /media/truecrypt1/source

This file is open in CLion, but when I was in securitytoken.h and browsed to a symbol it opened:


Then when I went to edit that file it said it wasn't part of the project.

I'm going to file this as a bug I think.


Tested it without the symlink and it works properly, so I'm going to file a bug.


I don't have access to report bugs. :(

Here is the issue without the specific problems I am experiencing, but if fixed it would fix my issues too:


Looks like it's been tracked since September with no action.  I would like to upvote it for attention at least, or report a bug with the specific problems.  Not sure why they disable bug reporting.

If anyone from JB reads this, hopefully they can get some attention to that bug. :)


Hi Mike

I just had the same problem with "CLion".

To fix the problem I clicked the header "File" and then choose "Reload CMake Project"

I hope this fixes your problem. :)



Thanks for the tip.  I have learned to just avoid symlinks.  I haven't tested it since they introduced the cmake reload feature a ways back.  Next time I accidentally open a project from a symlink I'll test this.


Please sign in to leave a comment.