简体   繁体   English

Intellisense不适用于Visual Studio 2017中的cmake项目

[英]Intellisense not working for cmake projects in Visual Studio 2017

I'm using Visual Studio for a cmake project (Rigid Body simulation, but that probably doesn't matter). 我正在将Visual Studio用于cmake项目(刚体模拟,但这可能无关紧要)。 My problem is that Intellisense does not work at all, meaning no autocomplete and no underlining of syntax errors. 我的问题是Intellisense根本不起作用,这意味着没有自动完成功能,也没有语法错误的下划线。 I checked the options menu (options -> Text Editor -> C++ -> advanced -> Intellisense) and Intellisense seems to be turned on, however I don't understand all the options exactly. 我检查了选项菜单(选项->文本编辑器-> C ++->高级-> Intellisense),似乎已打开Intellisense,但是我不完全理解所有选项。

Pressing ctrl + space (autocomplete) the bottom bar says 'No additional information available (see 'Troubleshooting Intellisense in c++ projects' for further help)'. 按下ctrl +空格(自动完成),底部栏显示“没有其他可用信息(请参阅'在c ++项目中对Intellisense进行故障排除'以获取更多帮助)”。 However Intellisense works well in a standdard c++ project, and searching for the mentioned term tells me to check my options menu. 但是,Intellisense在标准c ++项目中效果很好,搜索提到的术语会告诉我检查我的选项菜单。

Searching for my issue on Google I've found this page: https://docs.microsoft.com/en-us/cpp/ide/how-to-enable-intellisense-for-makefile-projects?view=vs-2017 , but I can't follow its instructions further than step 3 since my Property Pages -> Configuration property does not contain an 'NMake' page (I only have a 'General' page). 在Google上搜索我的问题,我已经找到此页面: https : //docs.microsoft.com/zh-cn/cpp/ide/how-to-enable-intellisense-for-makefile-projects?view=vs-2017 ,但是由于“属性页面”->“配置”属性不包含“ NMake”页面(我只有“常规”页面),因此我无法按照步骤3进行操作。

Thanks for your help. 谢谢你的帮助。

Some Detail that may be of use: 可能有用的一些细节:
Operating System: Windows 10, 1803, build 17134.285 操作系统:Windows 10,1803,build 17134.285
Visual Studio: Community 2017, Version 15.8.6 Visual Studio:社区2017年版本15.8.6
CMake: Version 3.12.2 CMake:版本3.12.2

I had a very similar issue and it turned out to be related to git - visual studio 2017 has a bug , which breaks Intellisense if the git repository is cloned through WSL. 我有一个非常相似的问题,事实证明它与git有关-visual studio 2017 有一个错误 ,如果通过WSL克隆git存储库,则会破坏Intellisense。 So if you are using git, try to clone the repository through visual studio. 因此,如果您使用的是git,请尝试通过Visual Studio克隆存储库。

Ah, and, in case you didn't know, with VS2017 you can just open the cmake directory through the "Open folder" feature - no need to generate the project files manually anymore. 嗯,如果您不知道,使用VS2017,您可以通过“打开文件夹”功能打开cmake目录-不再需要手动生成项目文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM