I'm having a weird problem with Visual Code wxwidgets Intellisense. After I launch VC, within about 2 seconds, if I quickly mouse over a wxWidgets class or function it shows the appropriate data. After about 2 seconds, wxWidgets Intellisense stops working. C++ Intellisense continues to work fine.
This is the output of wx-config --cxxflags
-I/Users/lk/files/programs/wxWidgets-3.0.5/deploy/lib/wx/include/osx_cocoa-unicode-static-3.0 -I/Users/lk/files/programs/wxWidgets-3.0.5/include -D_FILE_OFFSET_BITS=64 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__
This is my c_cpp_properties.json file
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/Users/lk/files/programs/wxWidgets-3.0.5/include/**",
"/Users/lk/files/programs/wxWidgets-3.0.5/deploy/lib/wx/include/osx_cocoa-unicode-static-3.0/**"
],
"defines": [
"_FILE_OFFSET_BITS=64",
"__WXMAC__",
"__WXOSX__",
"__WXOSX_COCOA__"
],
"macFrameworkPath": [
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++98",
"intelliSenseMode": "macos-clang-x64"
}
],
"version": 4
}
I'm using Visual Code 1.64.0 on macOS Big Sur. I have spent hours googling and debugging this but could not get it to work.
Related
I was trying to switch my Vscode from msys2 gcc to msys2 clang. I have downloaded clang according to the msys2 documentation provided. I have also followed the visual studio documentation for setting up clang. But my visual code fails to recognize iostream header.
I updated my environment path:
I also updated required include paths in my vs code configuration files:
cpp_properties:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceRoot}",
"C:/msys64/clang64/include",
"C:/msys64/clang64/include/**",
"C:/msys64/clang64",
"C:/msys64/clang64/include/c++/v1",
"C:/msys64/clang64/lib/clang/14.0.4/include",
"C:/msys64/clang64/lib/clang/14.0.4/include/**",
"${workspaceFolder}/**",
"C:/msys64/clang64/bin",
"C:/msys64"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.19041.0",
"compilerPath": "C:/msys64/clang64/bin/clang++.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"C:/msys64/clang64/include",
"C:/msys64/clang64/include/**",
"C:/msys64/clang64/include/c++/v1",
"C:/msys64/clang64/lib/clang/14.0.4/include",
"C:/msys64/clang64/lib/clang/14.0.4/include/**",
"${workspaceRoot}",
"C:/msys64/clang64/bin",
"C:/msys64"
],"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 4
}
Still i keep getting the following error:
i have mingwx64 installed on my device and is in the path variables as well
i can run it in terminal and powershell and pretty much everywhere but still in vs code it is showing my an error like this.the error message
also the c_cpp_properties.json file screenshot
{
"configurations": [
{
"name": "windows-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "gcc",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "windows-gcc-x64",
"compilerArgs": []
}
],
"version": 4
}
please help...
I am preparing to develop a cross-platform project with CMake and so I used Cmake Tools and it created following compilerPaths:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c18",
"cppStandard": "c++20",
"intelliSenseMode": "clang-x64",
"configurationProvider": "ms-vscode.cmake-tools",
"compilerArgs": [],
"browse": {
"path": [
"${workspaceFolder}/**"
],
"limitSymbolsToIncludedHeaders": true
}
},
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe",
"cStandard": "c18",
"cppStandard": "c++20",
"intelliSenseMode": "msvc-x64",
"compilerArgs": [],
"browse": {
"path": [
"${workspaceFolder}/**"
],
"limitSymbolsToIncludedHeaders": true
}
}
],
"version": 4
}
In PROBLEMS tab I see Cannot find "\usr\bin\gcc". and that's obvious, because I am on Windows, but
the name values Linux and Win32 have some special meanings and
the paths have not been generated by me, but automatically so
I would expect the "PROBLEM" should not be there.
So how to correctly fix the "PROBLEM"?
You just need to switch the config.
On the bottom right it should say Linux (the name of the config).
Click on Linux and switch to Win32.
I got the same error on Windows when my config was set to Linux. When switching to the Win32 config I get no error.
I am using visual studio code for c++ programming. Whenever I run my program, it gives me the following error:
include errors detected.
Please update your includePath.
Squiggles are disabled for this translation unit
(/home/yash_j1301/Documents/GitHub/C++ Workspace/yash1.cpp).
I am using Ubuntu 19.04 Disco Dingo and quite new to c++ programming. On the internet, I found some solutions like giving the path to the header files and I did that but still it is showing me errors. I already have installed and updated all the c/c++ extensions for the same.
Any idea where it is going wrong? I have already attached the screenshot for the error.
Here is my c_cpp_properties.json file code:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/home/yash_j1301/TC/INCLUDE/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
},
{
"name": "conf1",
"includePath": [
"/home/yash_j1301/TC/CLASSLIB/INCLUDE/",
"/home/yash_j1301/TC/INCLUDE/SYS/",
"/home/yash_j1301/TC/INCLUDE/"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
Any idea what I'm missing out?
These are the things you can do :
check if you have installed the c/c++ extension.
Check if mingw-w64 is installed (http://www.mingw-w64.org/doku.php )
right click on the import statement and add it to the path :
Here are all the details: https://code.visualstudio.com/docs/languages/cpp
I use Visual Studio code with the extensions "C/C++ for Visual Studio Code" (ms-vscode.cpptools) for developing simple C++ programs. I have added the configuration file cpp_properties.json to the .vscode subfolder to get intellisense support (see below). Unfortunately VS code does not honor the include path defined herein. I always get green swiggles under #include directives saying #include errors detected. Please update your includePath. ....
What's strange is, that the before mentioned error disappears when I select the correct configuration using the command C/Cpp: Select a configuration .... I have to repeat this command everytime I reopen the project. So obviously the include paths seems to be correct.
Is it possible to make VS Code or the CPP extension store the active configuration? Or is it at least possible to define a default configuration?
c_cpp_properties.json:
{
"configurations": [{
"name": "MinGW on Windows",
"includePath": [
"${workspaceRoot}",
"${MINGW_HOME}\\include\\c++\\7.1.0",
"${MINGW_HOME}\\include\\c++\\7.1.0\\x86_64-w64-mingw32",
"${MINGW_HOME}\\include\\c++\\7.1.0\\backward",
"${MINGW_HOME}\\lib\\gcc\\x86_64-w64-mingw32\\7.1.0\\include",
"${MINGW_HOME}\\include",
"${MINGW_HOME}\\x86_64-w64-mingw32\\include"
],
"defines": [],
"browse": {
"path": [
"${workspaceRoot}",
"${MINGW_HOME}\\include\\c++\\7.1.0",
"${MINGW_HOME}\\include\\c++\\7.1.0\\x86_64-w64-mingw32",
"${MINGW_HOME}\\include\\c++\\7.1.0\\backward",
"${MINGW_HOME}\\lib\\gcc\\x86_64-w64-mingw32\\7.1.0\\include",
"${MINGW_HOME}\\include",
"${MINGW_HOME}\\x86_64-w64-mingw32\\include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"intelliSenseMode": "clang-x64"
},
{
"name": "GCC on Linux",
"includePath": [
"${workspaceRoot}",
"/usr/include/c++/6",
"/usr/include/x86_64-linux-gnu/c++/6",
"/usr/include/c++/6/backward",
"/usr/lib/gcc/x86_64-linux-gnu/6/include",
"/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed",
"/usr/include"
],
"defines": [],
"browse": {
"path": [
"/usr/include/c++/6",
"/usr/include/x86_64-linux-gnu/c++/6",
"/usr/include/c++/6/backward",
"/usr/lib/gcc/x86_64-linux-gnu/6/include",
"/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed",
"/usr/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"intelliSenseMode": "clang-x64"
}
],
"version": 2
}