Giter Club home page Giter Club logo

Comments (4)

Colengms avatar Colengms commented on May 28, 2024

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.

cosmo86 avatar cosmo86 commented on May 28, 2024

@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.

cosmo86 avatar cosmo86 commented on May 28, 2024

@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.

Colengms avatar Colengms commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.