Fixing Intellisense

Sysprogs forums Forums VisualGDB Fixing Intellisense

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #21646
    JulianH93
    Participant

    Hello again,

    I always have problems with the intellisense engine of VisualGDB. After I included the C++ STL library “filesystem” almost the whole project got red underlined. Is there a way to fix such sings up? Or is this a known issue?

    It’s like the intellisense is somehow setting the __cplusplus macro wrong, so the #if in the filesystem-header fails:

    #ifndef _GLIBCXX_FILESYSTEM
    #define _GLIBCXX_FILESYSTEM 1

    #pragma GCC system_header

    #if __cplusplus >= 201703L

    #include <bits/fs_fwd.h>
    #include <bits/fs_path.h>
    #include <bits/fs_dir.h>
    #include <bits/fs_ops.h>

    #define __cpp_lib_filesystem 201703

    #endif // C++17

    #endif // _GLIBCXX_FILESYSTEM

     

    I don’t know why this is happening. The GCC Version on the target machine is 8.2 and everything is compiling fine.

     

    #21648
    support
    Keymaster

    Hi,

    Please ensure you are using the Clang IntelliSense provided by VisualGDB that is specifically optimized to handle GCC-specific code.

    If you are not sure, please attach a screenshot of the entire VS window showing the problem.

    If switching the IntelliSense engine doesn’t help, please let us know your project type (Make, CMake, MSBuild, QMake, etc) and we will provide more detailed diagnostic instructions.

    #21662
    JulianH93
    Participant

    I don’t really know how I may capture the whole error in one image. So here are some pictures.

    Where I suspect the error is in the filesystem-header, cause Intellisense isn’t parsing the header correctly:

    I estimate after I included this header, Intellisense bugged up:

    stdafx.h:

    The cpp file:

    IntelliSense Settings:

    • This reply was modified 6 years, 4 months ago by JulianH93.
    #21674
    support
    Keymaster

    Hi,

    Thanks for the screenshots. Looks like the Clang IntelliSense is successfully initialized.

    Please try locating the following file:

    %LOCALAPPDATA%\VisualGDB\ToolchainProfiles\<host name>\com.sysprogs.toolchain.default-gcc-\IntelliSense.props

    Does the __cplusplus value recorded there match what you expect? Are you using the correct “language standard” setting in VS Project Properties -> C/C++?

    #21701
    JulianH93
    Participant

    No, __cplusplus value does not hit my expecations.

    The highest I could find are:

    … <ItemGroup>
     <ClCompile Condition="'%(ClCompile.CPPLanguageStandard)' == 'CPP1Z'">
     <PreprocessorDefinitions>%(ClCompile.PreprocessorDefinitions);__cpp_attributes=200809;__cpp_aggregate_nsdmi=201304;__cpp_static_assert=200410;__cpp_variadic_templates=200704;__cpp_variable_templates=201304;__GXX_EXPERIMENTAL_CXX0X__=1;__cpp_delegating_constructors=200604;__STDC_UTF_16__=1;__cpp_raw_strings=200710;__STRICT_ANSI__=1;__cplusplus=201500L;__cpp_ref_qualifiers=200710;__cpp_rvalue_reference=200610;__cpp_nsdmi=200809;__cpp_initializer_lists=200806;__cpp_lambdas=200907;__cpp_unicode_characters=200704;__cpp_decltype_auto=201304;__cpp_digit_separators=201309;__cpp_unicode_literals=200710;__cpp_sized_deallocation=201309;__cpp_range_based_for=200907;__cpp_return_type_deduction=201304;__cpp_decltype=200707;__cpp_inheriting_constructors=200802;__GNUC_STDC_INLINE__=1;__STDC_UTF_32__=1;__cpp_alias_templates=200704;__cpp_constexpr=201304;__cpp_generic_lambdas=201304;__cpp_user_defined_literals=200809;__cpp_init_captures=201304</PreprocessorDefinitions>
     </ClCompile>
     </ItemGroup>
    
     <ItemGroup>
     <ClCompile Condition="'%(ClCompile.CPPLanguageStandard)' == 'GNUPP1Z'">
     <PreprocessorDefinitions>%(ClCompile.PreprocessorDefinitions);__cpp_attributes=200809;__cpp_aggregate_nsdmi=201304;__cpp_static_assert=200410;__cpp_variadic_templates=200704;__cpp_variable_templates=201304;__GXX_EXPERIMENTAL_CXX0X__=1;__cpp_delegating_constructors=200604;__STDC_UTF_16__=1;__cpp_raw_strings=200710;__cplusplus=201500L;__cpp_ref_qualifiers=200710;__cpp_rvalue_reference=200610;__cpp_nsdmi=200809;__cpp_initializer_lists=200806;__cpp_lambdas=200907;__cpp_unicode_characters=200704;__cpp_decltype_auto=201304;unix=1;__cpp_digit_separators=201309;__GLIBCXX_BITSIZE_INT_N_0=128;__cpp_unicode_literals=200710;__cpp_sized_deallocation=201309;linux=1;__cpp_range_based_for=200907;__cpp_return_type_deduction=201304;__cpp_decltype=200707;__cpp_inheriting_constructors=200802;__GNUC_STDC_INLINE__=1;__STDC_UTF_32__=1;__cpp_alias_templates=200704;__cpp_constexpr=201304;__GLIBCXX_TYPE_INT_N_0=__int128;__cpp_generic_lambdas=201304;__cpp_user_defined_literals=200809;__cpp_init_captures=201304</PreprocessorDefinitions>
     </ClCompile>
     </ItemGroup>
    
    I created the project before I installed the GCC 8.2 Toolchain on the target machine. Maybe I somehow have to reconfigure the VisualGDB settings?
    • This reply was modified 6 years, 4 months ago by JulianH93.
    • This reply was modified 6 years, 4 months ago by JulianH93.
    • This reply was modified 6 years, 4 months ago by JulianH93.
    #21710
    support
    Keymaster

    Hi,

    Thanks for checking it – that explains what is going on. Looks like VisualGDB indeed cached the values from the previous compiler.

    Please click “Regenerate MSBuild Files” on the MSBuild Settings page of VisualGDB Project Properties, or simply delete the IntelliSense.props file and reopen the project to regenerate the toolchain files.

    #21761
    JulianH93
    Participant

    Now the __cplusplus values are set correctly, but nothing changed. Intellisense is still not working correctly.

    #21763
    support
    Keymaster

    Hi,

    OK, please try isolating one specific case of broken IntelliSense (e.g. some variable or function is not found) and check if it’s still related to the mismatching __cplusplus definition, or something else (e.g. missing hardware/software FP macros). If you need more detailed instructions on this, please let us know a specific example of an IntelliSense error and we will help you narrow it down.

    #21975
    JulianH93
    Participant

    Now I replaced std::filesystem by boost::filesystem, but the errors are still there. Intellisense even can’t find #include <vector> in the stdafx.h (it’s the upper most header included, no more code before #include <vector>). In the meantime I switched my maschine, but the error still exists.

    “stdafx.h”:
    #pragma once

    #include <vector>
    #include <string>
    #include <cstdint>
    #include <memory>
    #include <iostream>
    #include <mutex>
    #include <thread>
    #include <iomanip>
    #include <atomic>
    #include <ctime>
    #include <queue>
    #include <ctime>
    #include <cstdio>
    #include <unordered_map>
    #include <chrono>
    #include <fstream>
    #include <utility>
    #include <optional>
    #include <boost/filesystem.hpp>
    #include <boost/asio.hpp>
    #include <boost/algorithm/string.hpp>
    #include <boost/program_options.hpp>
    #include <assert.h>
    #include <string.h>
    #include <unistd.h>
    #include <linux/can.h>
    #include <linux/can/raw.h>
    #include <signal.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <sys/ioctl.h>
    #include <net/if.h>

    • This reply was modified 6 years, 3 months ago by JulianH93.
    #21990
    support
    Keymaster

    Hi,

    Strange. Could you please try locating the <vector> file manually (both on remote machine and locally in %LOCALAPPDATA%\VisualGDB) and check if the corresponding directory is listed on the IntelliSense Directories page?

    #21992
    JulianH93
    Participant

    vector on Windows maschine is in: \VisualGDB\RemoteSourceCache\192.168.0.138\0000\include\c++\8\vector

    vector on Linux maschine is in: /usr/include/c++/8/profile/vector

    And here is the IntelliSense Directory:

    right click on vector and try to open it:

    It says: “vector couldnt’t be found in the actual source directory or in the build system path. Actual source path: “source to the root path of my project” Buildsystempath is empty.

    • This reply was modified 6 years, 3 months ago by JulianH93.
    • This reply was modified 6 years, 3 months ago by JulianH93.
    #22000
    support
    Keymaster

    Hi,

    The error message looks like something shown by Visual Studio itself, not VisualGDB. It might indicate that IntelliSense is not properly initialized for the source file you are editing.

    Are you using the Clang IntelliSense? If not, does the problem get solved if you enable it? If yes, please share a screenshot of the entire VS window showing the source file you opened (including any navigation bars on top) so we could check which IntelliSense engine is handling it.

    #22017
    b.timofte
    Participant

    I had similar issue in the past . It looks like VisualGDB cannot handle Boost library template headers . I tried with REsharper c++ and was much better

     

    See my thread with Boost and Xerces 🙂

     

    xerces xml parser clang fail

    • This reply was modified 6 years, 3 months ago by b.timofte.
    #22019
    support
    Keymaster

    Hi,

    This is likely caused by a missing setting, or an incompletely imported project. We can help you get it to work if you could share the details we requested.

    #22020
    support
    Keymaster

    Hi,

    This is likely caused by a missing setting, or an incompletely imported project. We can help you get it to work if you could share the details we requested.

Viewing 15 posts - 1 through 15 (of 24 total)
  • You must be logged in to reply to this topic.