Home >Computer Tutorials >Computer Knowledge >VSCode and VS C++ IntelliSense not working or picking up libraries

VSCode and VS C++ IntelliSense not working or picking up libraries

WBOY
WBOYforward
2024-02-29 13:28:57855browse

VS Code and Visual Studio C IntelliSense may not be able to pick up libraries, especially when working on large projects. When we hover over #Include, we see the error message "Cannot Open source file 'string.h'" (depends on "wx/wx.h"), sometimes, automatically The completion function is not responding. In this article we will see what you can do if VSCode and VSC IntelliSense are not working or extracting libraries.

VSCode和VS C++IntelliSense无法工作或拾取库

Why doesn't my IntelliSense work in C?

When processing large files, IntelliSense sometimes becomes unresponsive in Visual Studio. At this time, re-creating the database is the solution to the problem. This action will reset the text editor's database and get your project back to normal. Below, we've detailed the steps to do this.

Fix VSCode and VS C IntelliSense not working or picking up libraries

If VSCode and VS C IntelliSense are not working or picking up libraries, please follow the solutions below to resolve the issue.

  • Install the complete C extension
  • Recreate database
  • Reinstall C/C
  • Install CMake extension in Visual Studio
  • Reinstall Visual Studio or VSCode
  • Let’s talk about it in detail.

    1]Install the complete C extension

    Although it is not necessary to install the C extension, if you are facing this problem, we recommend that you go ahead and install it. It will install all the required tools, the absence of which may cause problems. To install an extension, open Visual Studio Code, go to the Extensions section, enter "C/C extension package" and click the relevant install button. Hopefully, this will do the trick for you.

    2]Recreate the database

    I have observed that once a project grows to a certain size (usually around 4100 lines of code), the autocomplete feature in Visual Studio stops working properly. Simply put, performance tends to degrade as the number of third-party libraries increases, causing namespaces, class attributes, and methods to become invisible. To get things back on track we need to recreate the database. Follow the steps mentioned below to perform the same.

  • Open these tools.
  • Enter the options bar and search for "database".
  • Next, go to Text Editor > C/C > Advanced.
  • Finally, set Recreate Database=TRUE.
  • You can now check if the issue has been resolved.

    Read: IntelliSense not working in VS Code

    3]Simplified Chinese

    Perhaps there are some problems when you install C/C, causing Intellisense to not correctly identify the library. In this case, it is recommended that you uninstall the current C/C version and then follow the correct steps to reinstall a new copy. This helps solve the problem of Intellisense not being able to pick up libraries.

    4]Install CMake extension in Visual Studio

    VSCode和VS C++IntelliSense无法工作或拾取库

    CMake is an open source tool for build automation, testing, packaging and software installation. It generates build scripts for multiple platforms, including Windows, MacOS, and Linux. Its flexibility helps developers build projects faster. This is an alternative that can be used in your project if IntelliSense does not have a picking library. To make it easier for you, there is a CMake extension that you can install easily.

    Follow the steps mentioned below to perform the same.

  • Open the Visual Studio installer.
  • Go to the installed Visual Studio instance and click Modify.
  • From Workloads, go to Desktop development with C under Desktop Mobile.
  • Make sure you select the Linux and Embedded C development components on this page for cross-platform CMake development capabilities.
  • Click Modify to confirm your action.
  • Hopefully, this will do the trick for you.

    The above is the detailed content of VSCode and VS C++ IntelliSense not working or picking up libraries. For more information, please follow other related articles on the PHP Chinese website!

    Statement:
    This article is reproduced at:mryunwei.com. If there is any infringement, please contact admin@php.cn delete