【发布时间】:2017-01-08 13:06:49
【问题描述】:
我正在使用 Win10 64 位的 Visual Studio 2015 中的 CMake 构建系统开发 C++ 项目。
我曾经在 C++ 文件中创建函数定义,方法是单击标题中的声明,然后单击 Quick Actions and Refactorings->Create Declaration / Definition。
由于某种原因,此功能在我的项目中不再起作用。每当我尝试使用“创建定义”时,都会收到以下错误消息:
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
另外,当我选择Quick Actions and Refactorings 时,会出现只有两个选项的小弹出窗口:
当这个功能起作用时,VS 通常会显示带有四个选项的窗口,如下所示:
我知道关于 SO 有很多类似的问题,但似乎都没有解决这个特定的错误。到目前为止,我已经尝试了所有建议:
- 重启 VS 和 Windows
- 清洁解决方案
- 完全删除构建文件夹(包含所有 .suo 和 .user 文件以及隐藏目录)并使用 CMake 重新创建它
- 删除
%LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache的内容 - 查看
%LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache目录中的.err.文件 - 没有相关错误。 - 使用
devenv.exe /resetuserdata重置所有VS用户数据 - 关闭所有其他编辑器、资源管理器窗口等。
这些都没有任何影响。
这个功能很棒,但问题很烦人。如果有人有任何线索,请帮助。
【问题讨论】:
标签: c++ visual-studio visual-studio-2015 intellisense