I am developing a C++ project with CMake build system in Visual Studio 2015 on Win10 64bit.
I used to create function definitions in C++ file by clicking on the declaration in the header and then Quick Actions and Refactorings->Create Declaration / Definition.
For some reason this feature does not work in my project anymore. Whenever I try to use "Create Definition" I get this error message:
The operation 'Create Declaration / Definition' could not be completed for the following reason:
Add/Remove operation is impossible, because the code element 'NameOfClass' is read only

Also, when I choose Quick Actions and Refactorings small popup window appears with just two options:

When this feature works VS usually shows window with four options, like this:

I know there are tons of similar questions on SO, but none of the seem to address this particular error. I've tried everything suggested so far:
%LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache.err. file in directory %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache - no relevant errors.devenv.exe /resetuserdataNone of this has any effect.
This feature is great and the issue is very annoying. If anyone has any clue, please help.
Ok, my bad. I had a mistake in CMake scripts, that's why some of the header files were not included in the Visual Studio project. If you have this error make sure both .cpp and .hpp files are added to your VS project files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With