Comments (4)
Hi @cosmo86 . Can you provide the output of the C/C++: Log Diagnostics
command, with the repro'ing file open? That should indicate how IntelliSense was configured for the file.
Are there any errors prior to the line you're expecting to see one on? It's possible there may be prior errors in headers that are preventing later code from being parsed properly, or altering the context in which that code is interpreted (such as an immediately previous class missing a semicolon, or missing closing brace or bracket, for example).
Can you provide a zip file containing a stand-alone repro that we could investigate further?
from vscode-cpptools.
@Colengms Thanks very much for the reply!!
here is the log from one of the many files that has Intellisense issue, i will provide another log from one of the file which Intellisense works normally.
THE ONE WITH ISSUE:
-------- Diagnostics - 1/23/2024, 1:37:59 PM
Version: 1.18.5
Current Configuration:
{
"name": "Linux",
"includePath": [
"/root/"
],
"defines": [],
"compilerPath": "/opt/rh/devtoolset-7/root/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64",
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"intelliSenseModeIsExplicit": true,
"compilerPathInCppPropertiesJson": "/opt/rh/devtoolset-7/root/usr/bin/gcc",
"mergeConfigurations": false,
"browse": {
"path": [
"/root/",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
cpptools version (native): 1.18.3.0
Translation Unit Mappings:
[ /root/usr_1/cpp_engine_panic/src/dispatcher.cpp ]:
/root/usr_1/cpp_engine_panic/src/dispatcher.cpp
/root/usr_1/cpp_engine_panic/src/dispatcher.h *
/root/usr_1/cpp_engine_panic/model/SEObject.hpp *
[ /root/usr_1/cpp_engine_panic/Strategy/HitBanStrategy.cpp ]:
/root/usr_1/cpp_engine_panic/Strategy/HitBanStrategy.cpp
[ /root/usr_1/cpp_engine_panic/include/L2_quoter.cpp ]:
/root/usr_1/cpp_engine_panic/include/L2_quoter.cpp
Translation Unit Configurations:
[ /root/usr_1/cpp_engine_panic/src/dispatcher.cpp ]:
Process ID: 25835
Memory Usage: 233 MB
Compiler Path: /opt/rh/devtoolset-7/root/usr/bin/gcc
Includes:
/opt/rh/devtoolset-7/root/usr/include/c++/7
/opt/rh/devtoolset-7/root/usr/include/c++/7/x86_64-redhat-linux
/opt/rh/devtoolset-7/root/usr/include/c++/7/backward
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include
/usr/local/include
/opt/rh/devtoolset-7/root/usr/include
/usr/include
/root/usr_1/cpp_engine_panic/include
/root/usr_1/cpp_engine_panic/model
/root/usr_1/cpp_engine_panic/spdlog
/root/usr_1/cpp_engine_panic/Strategy
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmlibarchive/build
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/std/cm
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmnghttp2
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/std
/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/jsonschema_specifications/schemas/draft202012/vocabularies
/root/usr_1/cpp_engine_panic/spdlog/spdlog
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cm3p
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcppdap/include/dap
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcurl/lib
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcurl/include
Standard Version: c++17
IntelliSense Mode: linux-gcc-x64
Other Flags:
--g++
--gnu_version=70301
[ /root/usr_1/cpp_engine_panic/Strategy/HitBanStrategy.cpp ]:
Process ID: 25975
Memory Usage: 181 MB
Compiler Path: /opt/rh/devtoolset-7/root/usr/bin/gcc
Includes:
/opt/rh/devtoolset-7/root/usr/include/c++/7
/opt/rh/devtoolset-7/root/usr/include/c++/7/x86_64-redhat-linux
/opt/rh/devtoolset-7/root/usr/include/c++/7/backward
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include
/usr/local/include
/opt/rh/devtoolset-7/root/usr/include
/usr/include
/root/usr_1/cpp_engine_panic/include
/root/usr_1/cpp_engine_panic/model
/root/usr_1/cpp_engine_panic/spdlog
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmlibarchive/build
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/std/cm
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/std
/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/jsonschema_specifications/schemas/draft202012/vocabularies
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmnghttp2
/root/usr_1/cpp_engine_panic/spdlog/spdlog
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcppdap/include/dap
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcurl/lib
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cm3p
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcurl/include
Standard Version: c++17
IntelliSense Mode: linux-gcc-x64
Other Flags:
--g++
--gnu_version=70301
[ /root/usr_1/cpp_engine_panic/include/L2_quoter.cpp ]:
Process ID: 26709
Memory Usage: 183 MB
Compiler Path: /opt/rh/devtoolset-7/root/usr/bin/gcc
Includes:
/opt/rh/devtoolset-7/root/usr/include/c++/7
/opt/rh/devtoolset-7/root/usr/include/c++/7/x86_64-redhat-linux
/opt/rh/devtoolset-7/root/usr/include/c++/7/backward
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include
/usr/local/include
/opt/rh/devtoolset-7/root/usr/include
/usr/include
/root/usr_1/cpp_engine_panic/Strategy
/root/usr_1/cpp_engine_panic/model
/root/usr_1/cpp_engine_panic/spdlog
/root/usr_1/cpp_engine_panic/include
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmlibarchive/build
/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/jsonschema_specifications/schemas/draft202012/vocabularies
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/std/cm
/root/usr_1/cpp_engine_panic/spdlog/spdlog
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmnghttp2
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/std
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcppdap/include/dap
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcurl/lib
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cm3p
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcurl/include
Standard Version: c++17
IntelliSense Mode: linux-gcc-x64
Other Flags:
--g++
--gnu_version=70301
Total Memory Usage: 598 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 66286
Number of files parsed: 1857
------- Potential include path issues --------
Some headers exist in multiple locations. If IntelliSense is behaving incorrectly,
try adding one of the alternate paths to the "includePath" in your configuration in
c_cpp_properties.json to override the automatic path discovery for that header.
Using: /opt/rh/devtoolset-7/root/usr/include/c++/7/algorithm
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/std/cmext"
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/std/cm"
Using: /usr/include/assert.h
Alternative: "/root/usr_1/thrid_party_package/jemalloc-5.2.0/include/jemalloc/internal"
Using: /root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmSTL.hxx
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Bootstrap.cmk"
Using: /root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmnghttp2/config.h
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmliblzma"
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmlibarchive"
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmjsoncpp/include/json"
Alternative: "/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/pyarrow/include/arrow"
Alternative: "/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/pyarrow/include/arrow/util"
Using: /usr/include/ctype.h
Alternative: "/root/usr_1/thrid_party_package/Python-3.9.6/Objects/stringlib"
Alternative: "/root/usr_1/thrid_party_package/Python-3.7.9/Objects/stringlib"
Using: /root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cm3p/curl/curl.h
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcurl/include"
Using: /usr/include/errno.h
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmlibuv/include/uv"
Using: /root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcppdap/include/dap/io.h
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cm3p/cppdap"
Alternative: "/root/usr_1/thrid_party_package/Python-3.9.6/Modules/_decimal/libmpdec"
Alternative: "/root/usr_1/thrid_party_package/Python-3.7.9/Modules/_decimal/libmpdec"
Alternative: "/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/pyarrow/src/arrow/python"
Alternative: "/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/pyarrow/include/parquet/api"
Alternative: "/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/pyarrow/include/arrow/python"
Using: /usr/local/include/jemalloc/jemalloc.h
Alternative: "/root/usr_1/thrid_party_package/jemalloc-5.2.0/include"
Using: /usr/include/locale.h
Alternative: "/root/usr_1/cpp_engine_panic/spdlog/spdlog/fmt/bundled"
Using: /opt/rh/devtoolset-7/root/usr/include/c++/7/math.h
Alternative: "/root/usr_1/thrid_party_package/jemalloc-5.2.0/test/include/test"
Using: /usr/include/memory.h
Alternative: "/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/pyarrow/include/arrow/io"
Using: /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include/stdbool.h
Alternative: "/root/usr_1/thrid_party_package/jemalloc-5.2.0/include/msvc_compat/C99"
Using: /usr/include/strings.h
Alternative: "/root/usr_1/thrid_party_package/jemalloc-5.2.0/include/msvc_compat"
THE ONE WITHOUT ISSUE:
-------- Diagnostics - 1/23/2024, 1:40:16 PM
Version: 1.18.5
Current Configuration:
{
"name": "Linux",
"includePath": [
"/root/"
],
"defines": [],
"compilerPath": "/opt/rh/devtoolset-7/root/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64",
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"intelliSenseModeIsExplicit": true,
"compilerPathInCppPropertiesJson": "/opt/rh/devtoolset-7/root/usr/bin/gcc",
"mergeConfigurations": false,
"browse": {
"path": [
"/root/",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
cpptools version (native): 1.18.3.0
Translation Unit Mappings:
[ /root/usr_1/cpp_engine_panic/include/trader.cpp ]:
/root/usr_1/cpp_engine_panic/include/trader.cpp
Translation Unit Configurations:
[ /root/usr_1/cpp_engine_panic/include/trader.cpp ]:
Process ID: 27180
Memory Usage: 227 MB
Compiler Path: /opt/rh/devtoolset-7/root/usr/bin/gcc
Includes:
/opt/rh/devtoolset-7/root/usr/include/c++/7
/opt/rh/devtoolset-7/root/usr/include/c++/7/x86_64-redhat-linux
/opt/rh/devtoolset-7/root/usr/include/c++/7/backward
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include
/usr/local/include
/opt/rh/devtoolset-7/root/usr/include
/usr/include
/root/usr_1/cpp_engine_panic/spdlog
/root/usr_1/cpp_engine_panic/model
/root/usr_1/cpp_engine_panic/include
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmlibarchive/build
/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/jsonschema_specifications/schemas/draft202012/vocabularies
/root/usr_1/cpp_engine_panic/spdlog/spdlog
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmnghttp2
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcppdap/include/dap
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcurl/lib
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcurl/include
/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cm3p
Standard Version: c++17
IntelliSense Mode: linux-gcc-x64
Other Flags:
--g++
--gnu_version=70301
Total Memory Usage: 227 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 66286
Number of files parsed: 1857
------- Potential include path issues --------
Some headers exist in multiple locations. If IntelliSense is behaving incorrectly,
try adding one of the alternate paths to the "includePath" in your configuration in
c_cpp_properties.json to override the automatic path discovery for that header.
Using: /opt/rh/devtoolset-7/root/usr/include/c++/7/algorithm
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/std/cmext"
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/std/cm"
Using: /usr/include/assert.h
Alternative: "/root/usr_1/thrid_party_package/jemalloc-5.2.0/include/jemalloc/internal"
Using: /root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmThirdParty.h
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Bootstrap.cmk"
Using: /root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmnghttp2/config.h
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmliblzma"
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmlibarchive"
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmjsoncpp/include/json"
Alternative: "/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/pyarrow/include/arrow"
Alternative: "/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/pyarrow/include/arrow/util"
Using: /usr/include/ctype.h
Alternative: "/root/usr_1/thrid_party_package/Python-3.9.6/Objects/stringlib"
Alternative: "/root/usr_1/thrid_party_package/Python-3.7.9/Objects/stringlib"
Using: /root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcurl/include/curl/curl.h
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cm3p"
Using: /usr/include/errno.h
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmlibuv/include/uv"
Using: /root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cmcppdap/include/dap/io.h
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/cm3p/cppdap"
Alternative: "/root/usr_1/thrid_party_package/Python-3.9.6/Modules/_decimal/libmpdec"
Alternative: "/root/usr_1/thrid_party_package/Python-3.7.9/Modules/_decimal/libmpdec"
Alternative: "/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/pyarrow/src/arrow/python"
Alternative: "/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/pyarrow/include/parquet/api"
Alternative: "/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/pyarrow/include/arrow/python"
Using: /usr/local/include/jemalloc/jemalloc.h
Alternative: "/root/usr_1/thrid_party_package/jemalloc-5.2.0/include"
Using: /usr/include/locale.h
Alternative: "/root/usr_1/cpp_engine_panic/spdlog/spdlog/fmt/bundled"
Using: /opt/rh/devtoolset-7/root/usr/include/c++/7/math.h
Alternative: "/root/usr_1/thrid_party_package/jemalloc-5.2.0/test/include/test"
Using: /usr/include/memory.h
Alternative: "/root/usr_1/engine_entry/myenv/lib/python3.9/site-packages/pyarrow/include/arrow/io"
Using: /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include/stdbool.h
Alternative: "/root/usr_1/thrid_party_package/jemalloc-5.2.0/include/msvc_compat/C99"
Using: /usr/include/strings.h
Alternative: "/root/usr_1/thrid_party_package/jemalloc-5.2.0/include/msvc_compat"
Note: I would love to provide you with the full repo, but here are trade-related sensitive info in the repo(as you might have gussed from the name of the files). So I probably cannot provide the full repo at this moment.
However, if the Log Diagnostics is not enough for you to debug the issue, I can try to de-sensitize the code and send you a copy.
Again thanks a lot!
from vscode-cpptools.
@Colengms As for this point you raised "Are there any errors prior to the line you're expecting to see one on? It's possible there may be prior errors in headers that are preventing later code from being parsed properly, or altering the context in which that code is interpreted (such as an immediately previous class missing a semicolon, or missing closing brace or bracket, for example)."
The answer is no. I consider myself a noob in c++. But for this issue, I have chacked carefully that there is no issue prior to my intended "a=1" error.
I also build my code using cmake and all moduels works as intended.
from vscode-cpptools.
Hi @cosmo86. In your logs, I see the following:
------- Potential include path issues --------
Some headers exist in multiple locations. If IntelliSense is behaving incorrectly,
try adding one of the alternate paths to the "includePath" in your configuration in
c_cpp_properties.json to override the automatic path discovery for that header.
Using: /opt/rh/devtoolset-7/root/usr/include/c++/7/algorithm
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/std/cmext"
Alternative: "/root/usr_1/thrid_party_package/cmake-3.28.1/Utilities/std/cm"
...
These ambiguities could easily result in IntelliSense choosing the wrong files, which could lead to errors prior to the code you expect to see the errors in.
It's unclear to me from your latest logs, but your initial issue referred to:
"includePath": [
"${workspaceFolder}/**"
],
Are you perhaps opening /root/
as your workspace folder? If so, you might consider scoping that down to opening only the nested folder containing your immediate project, so you're not pulling in header files for unrelated projects into your include paths.
Or, consider being more explicit with the contents of your includePath
setting, to only refer to the specific include directories you use when building the code.
Or, if you're using CMake and CMake Tools, I'd suggest setting "configurationProvider": "ms-vscode.cmake-tools"
in your configuration, to allow IntelliSense to be configured by your build system, which would use the same include paths as your build and shouldn't lead to those header ambiguities.
from vscode-cpptools.
Related Issues (20)
- Stepping over std::vector<std::string> v{""} with g++-12 incorrect jumps to the end of the function
- cpptools taking 100% cpu with kernel source when expected to be idle HOT 3
- Duplicate 'Add #include' code actions can appear if the same file exists at multiple locations
- Don't restart gdb process when retart debug
- Use of `/` as an include path causes crash/freeze on macOS HOT 2
- Allow configuring the shell environment (in cppbuild tasks as well as compiler queries) HOT 2
- Natvis: Size specifier for array-like structures is not working
- `memcpy()` is treated as a macro instead of a function
- How can I fix the c++stl cross-platform intellisence error? HOT 1
- Update 1.19.4 breaks wildcard operator '*' in tasks.json code will not compile HOT 13
- Add #include "file.h" is incorrectly suggested instead of <file.h> for subDir/file.h
- Can't see the run and debug button after installing C/C++ extension. HOT 2
- Error squiggles displayed for some unicode symbols
- Not all compilers are listed HOT 4
- Fix E2E inlay hint test
- Add to include code actions shows old folder suggestions after a folders are renamed (unless Rescan Workspace is used)
- The 'Add #include' code action incorrectly uses "../" instead of <> when an includePath is used that is lexicographically less than the source file's parent directory
- The "multiroot" test always fails on its first run on Windows lab machines
- Add support for multi-part clang argument `-index-store-path` to compiler query HOT 4
- C_Cpp.inlayHints settings don't take effect until IntelliSense is updated HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-cpptools.