C++11 is ignored by IntelliSense when using MSBuild.

Sysprogs forums Forums VisualGDB C++11 is ignored by IntelliSense when using MSBuild.

This topic contains 8 replies, has 2 voices, and was last updated by  support 2 years, 9 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #12802

    AskingQuestions
    Participant

    I’m using VGDB version 5.3.15.1896 with VS2017 with MSBuild on Win7. My development is on a remote Linux device with GCC v5.2.

    C++11 is not seen by intellisense and when I mouse over __cplusplus I get a value of 199711L. Under Project>Properties>Configuration Properties>C/C++>Advanced  I’ve tried both -std=c++11 and -std=gnu++11. My intellisense directories are all accounted for in the VGDB properties window.

    In the past I’ve used CMake and added the needed flags but now with VS2017 I need to use MSBuild and I don’t know how to tell intellisense that I am using C++11, I am using the VS intellisense and not Clang. Even if I change over to Clang I still cannot get C++11 to work.

    Lastly, my code is able to compile to GCC is getting the correct flag.

    #12815

    support
    Keymaster

    Hi,

    For MSBuild projects VisualGDB stores the IntelliSense configuration in the following file:

    Please check the conditional definitions for the C++ standard you are using, e.g.:

    You can also try deleting the file and re-opening the project. VisualGDB will then run the remote gcc and re-detect the preprocessor macros.

    #12824

    AskingQuestions
    Participant

    Under both CPP11 and GNU11 I have __cpp_attributes=200809. I deleted the IntelliSense.props file and then reopened VS2017 and upon loading VGDB recreated the file. This newly created file still has the same 200809 value as before deleting it.

    I then manually edited the file and changed the attributes value to __cpp_attributes=201103. This did not have any effect on IntelliSense, when looking at __cplusplus in my code it still listed it as 199711L.

     

    #12825

    AskingQuestions
    Participant

    To add to my post above, if I check the precompiler values for GCC (v5.2) with the command:

    gcc -dM -E - < /dev/null

    I see the output:

    __STDC_ISO_10646__ 201304L

    #12836

    support
    Keymaster

    Hi,

    OK, there are actually 3 different preprocessor macros related to the standard:

    • __cplusplus
    • __cpp_attributes
    • __STDC_ISO_10646__

    Please double-check that you are actually comparing the values of the same macro between the actual IntelliSense, IntelliSense.props and the gcc output. Also if you are using the Visual C++ IntelliSense (not Clang), it will set its own value of __cplusplus and modifying it would break IntelliSense (as it would include code paths using features that are not implemented by the VC++ IntelliSense).

    Please also attach a screenshot showing the incorrect IntelliSense behavior, so we could check if it could be caused by anything else.

     

    #12839

    AskingQuestions
    Participant

    I’ve attached two screenshots from VS2017. In the first image the sub-image labeled ‘A)’ shows that std::atomic is not found and the ‘B)’ shows the tooltip value of __cplusplus when I mouse-over it.  The second image shows that I have C++11 as the language, I get the same behavior if I use gnu++11 or c++11.

    Here are two entries from IntelliSense.prop (CPP11 and GNUPP11):

    <ItemGroup>
    <ClCompile Condition="'%(ClCompile.CPPLanguageStandard)' == 'CPP11'">
    <PreprocessorDefinitions>%(ClCompile.PreprocessorDefinitions);__cpp_attributes=200809;__cpp_static_assert=200410;__cpp_variadic_templates=200704;__GXX_EXPERIMENTAL_CXX0X__=1;__cpp_delegating_constructors=200604;__STDC_UTF_16__=1;__GNUC_STDC_INLINE__=1;__cpp_raw_strings=200710;__STRICT_ANSI__=1;__cplusplus=201103L;__cpp_ref_qualifiers=200710;__cpp_rvalue_reference=200610;__cpp_nsdmi=200809;__cpp_initializer_lists=200806;__cpp_lambdas=200907;__cpp_unicode_characters=200704;__cpp_unicode_literals=200710;__cpp_range_based_for=200907;__cpp_decltype=200707;__cpp_inheriting_constructors=200802;__STDC_UTF_32__=1;__cpp_alias_templates=200704;__cpp_constexpr=200704;__cpp_user_defined_literals=200809</PreprocessorDefinitions>
    </ClCompile>
    </ItemGroup><ItemGroup>
    <ClCompile Condition="'%(ClCompile.CPPLanguageStandard)' == 'GNUPP11'">
    <PreprocessorDefinitions>%(ClCompile.PreprocessorDefinitions);__cpp_attributes=200809;__cpp_static_assert=200410;__cpp_variadic_templates=200704;__GXX_EXPERIMENTAL_CXX0X__=1;__cpp_delegating_constructors=200604;__STDC_UTF_16__=1;__GNUC_STDC_INLINE__=1;__cpp_raw_strings=200710;__cplusplus=201103L;__cpp_ref_qualifiers=200710;__cpp_rvalue_reference=200610;__cpp_nsdmi=200809;__cpp_initializer_lists=200806;__cpp_lambdas=200907;__cpp_unicode_characters=200704;unix=1;__cpp_unicode_literals=200710;linux=1;__cpp_range_based_for=200907;__cpp_decltype=200707;__cpp_inheriting_constructors=200802;__STDC_UTF_32__=1;__cpp_alias_templates=200704;__cpp_constexpr=200704;__cpp_user_defined_literals=200809</PreprocessorDefinitions>
    </ClCompile>
    </ItemGroup>

     

    Here is another entry with __STDC_ISO_10646__:

     

    <ItemGroup>
    <ClCompile>
    <PreprocessorDefinitions>%(ClCompile.PreprocessorDefinitions);__DBL_MIN_EXP__=(-1021);__HQ_FBIT__=15;__UINT_LEAST16_MAX__=0xffff;__ARM_SIZEOF_WCHAR_T=4;__ATOMIC_ACQUIRE=2;__SFRACT_IBIT__=0;__FLT_MIN__=1.1754943508222875e-38F;__GCC_IEC_559_COMPLEX=2;__UFRACT_MAX__=0XFFFFP-16UR;__UINT_LEAST8_TYPE__=unsigned char;__DQ_FBIT__=63;__ARM_FEATURE_SAT=1;__ULFRACT_FBIT__=32;__SACCUM_EPSILON__=0x1P-7HK;__CHAR_BIT__=8;__USQ_IBIT__=0;__UINT8_MAX__=0xff;__ACCUM_FBIT__=15;__WINT_MAX__=0xffffffffU;__USFRACT_FBIT__=8;__ORDER_LITTLE_ENDIAN__=1234;__SIZE_MAX__=0xffffffffU;__ARM_ARCH_ISA_ARM=1;__WCHAR_MAX__=0xffffffffU;__LACCUM_IBIT__=32;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1=1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2=1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4=1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8=1;__GCC_ATOMIC_CHAR_LOCK_FREE=2;__GCC_IEC_559=2;__FLT_EVAL_METHOD__=0;__unix__=1;__LLACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-31LLK;__GCC_ATOMIC_CHAR32_T_LOCK_FREE=2;__FRACT_FBIT__=15;__UINT_FAST64_MAX__=0xffffffffffffffffULL;__SIG_ATOMIC_TYPE__=int;__UACCUM_FBIT__=16;__DBL_MIN_10_EXP__=(-307);__FINITE_MATH_ONLY__=0;__ARMEL__=1;__ARM_FEATURE_UNALIGNED=1;__LFRACT_IBIT__=0;__GNUC_PATCHLEVEL__=0;__LFRACT_MAX__=0X7FFFFFFFP-31LR;__UINT_FAST8_MAX__=0xff;__DEC64_MAX_EXP__=385;__UINT_LEAST64_MAX__=0xffffffffffffffffULL;__SA_FBIT__=15;__SHRT_MAX__=0x7fff;__LDBL_MAX__=1.7976931348623157e+308L;__FRACT_MAX__=0X7FFFP-15R;__UFRACT_FBIT__=16;__ARM_FP=12;__UFRACT_MIN__=0.0UR;__UINT_LEAST8_MAX__=0xff;__GCC_ATOMIC_BOOL_LOCK_FREE=2;__UINTMAX_TYPE__=long long unsigned int;__LLFRACT_EPSILON__=0x1P-63LLR;__linux=1;__DEC32_EPSILON__=1E-6DF;__CHAR_UNSIGNED__=1;__UINT32_MAX__=0xffffffffU;__ULFRACT_MAX__=0XFFFFFFFFP-32ULR;__TA_IBIT__=64;__LDBL_MAX_EXP__=1024;__WINT_MIN__=0U;__linux__=1;__ULLFRACT_MIN__=0.0ULLR;__SCHAR_MAX__=0x7f;__WCHAR_MIN__=0U;__DBL_DIG__=15;__GCC_ATOMIC_POINTER_LOCK_FREE=2;__LLACCUM_MIN__=(-0X1P31LLK-0X1P31LLK);__SIZEOF_INT__=4;__SIZEOF_POINTER__=4;__USACCUM_IBIT__=8;__USER_LABEL_PREFIX__;__STDC_HOSTED__=1;__LDBL_HAS_INFINITY__=1;__LFRACT_MIN__=(-0.5LR-0.5LR);__HA_IBIT__=8;__TQ_IBIT__=0;__FLT_EPSILON__=1.1920928955078125e-7F;__APCS_32__=1;__USFRACT_IBIT__=0;__LDBL_MIN__=2.2250738585072014e-308L;__FRACT_MIN__=(-0.5R-0.5R);__DEC32_MAX__=9.999999E96DF;__DA_IBIT__=32;__ARM_SIZEOF_MINIMAL_ENUM=4;__INT32_MAX__=0x7fffffff;__UQQ_FBIT__=8;__SIZEOF_LONG__=4;__UACCUM_MAX__=0XFFFFFFFFP-16UK;__STDC_IEC_559__=1;__STDC_ISO_10646__=201304L;__DECIMAL_DIG__=17;__LFRACT_EPSILON__=0x1P-31LR;__ULFRACT_MIN__=0.0ULR;__gnu_linux__=1;__ARM_PCS_VFP=1;__LDBL_HAS_QUIET_NAN__=1;__ULACCUM_IBIT__=32;__UACCUM_EPSILON__=0x1P-16UK;__GNUC__=5;__ULLACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-32ULLK;__HQ_IBIT__=0;__FLT_HAS_DENORM__=1;__SIZEOF_LONG_DOUBLE__=8;__BIGGEST_ALIGNMENT__=8;__DQ_IBIT__=0;__ULFRACT_IBIT__=0;__INT_FAST32_MAX__=0x7fffffff;__DBL_HAS_INFINITY__=1;__ACCUM_IBIT__=16;__DEC32_MIN_EXP__=(-94);__THUMB_INTERWORK__=1;__LACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-31LK;__INT_FAST16_TYPE__=int;__LDBL_HAS_DENORM__=1;__ARM_FEATURE_LDREX=15;__DEC128_MAX__=9.999999999999999999999999999999999E6144DL;__INT_LEAST32_MAX__=0x7fffffff;__DEC32_MIN__=1E-95DF;__ACCUM_MAX__=0X7FFFFFFFP-15K;__DBL_MAX_EXP__=1024;__USACCUM_EPSILON__=0x1P-8UHK;__DEC128_EPSILON__=1E-33DL;__SFRACT_MAX__=0X7FP-7HR;__FRACT_IBIT__=0;__PTRDIFF_MAX__=0x7fffffff;__UACCUM_MIN__=0.0UK;__STDC_NO_THREADS__=1;__UACCUM_IBIT__=16;__LONG_LONG_MAX__=0x7fffffffffffffffLL;__SIZEOF_SIZE_T__=4;__ULACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-32ULK;__SIZEOF_WINT_T__=4;__SA_IBIT__=16;__ULLACCUM_MIN__=0.0ULLK;__GXX_ABI_VERSION=1009;__UTA_FBIT__=64;__FLT_MIN_EXP__=(-125);__USFRACT_MAX__=0XFFP-8UHR;__UFRACT_IBIT__=0;__ARM_FEATURE_QBIT=1;__INT_FAST64_TYPE__=long long int;__LACCUM_MIN__=(-0X1P31LK-0X1P31LK);__ULLACCUM_FBIT__=32;__GXX_TYPEINFO_EQUALITY_INLINE=0;__ULLFRACT_EPSILON__=0x1P-64ULLR;__DEC128_MIN__=1E-6143DL;__REGISTER_PREFIX__;__UINT16_MAX__=0xffff;__DBL_HAS_DENORM__=1;__ACCUM_MIN__=(-0X1P15K-0X1P15K);__SQ_IBIT__=0;__UINT8_TYPE__=unsigned char;__UHA_FBIT__=8;__NO_INLINE__=1;__SFRACT_MIN__=(-0.5HR-0.5HR);__UTQ_FBIT__=128;__FLT_MANT_DIG__=24;__VERSION__="5.2.0";__ULLFRACT_FBIT__=64;__FRACT_EPSILON__=0x1P-15R;__ULACCUM_MIN__=0.0ULK;_STDC_PREDEF_H=1;__UDA_FBIT__=32;__LLACCUM_EPSILON__=0x1P-31LLK;__GCC_ATOMIC_INT_LOCK_FREE=2;__FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__;__USFRACT_MIN__=0.0UHR;__UQQ_IBIT__=0;__STDC_IEC_559_COMPLEX__=1;__DEC64_EPSILON__=1E-15DD;__ORDER_PDP_ENDIAN__=3412;__DEC128_MIN_EXP__=(-6142);__UHQ_FBIT__=16;__LLACCUM_FBIT__=31;__INT_FAST32_TYPE__=int;__UINT_LEAST16_TYPE__=short unsigned int;__INT16_MAX__=0x7fff;__SIZE_TYPE__=unsigned int;__UINT64_MAX__=0xffffffffffffffffULL;__UDQ_FBIT__=64;__INT8_TYPE__=signed char;__ELF__=1;__ULFRACT_EPSILON__=0x1P-32ULR;__LLFRACT_FBIT__=63;__FLT_RADIX__=2;__INT_LEAST16_TYPE__=short int;__ARM_ARCH_PROFILE=65;__LDBL_EPSILON__=2.2204460492503131e-16L;__SACCUM_MAX__=0X7FFFP-7HK;__SIG_ATOMIC_MAX__=0x7fffffff;__GCC_ATOMIC_WCHAR_T_LOCK_FREE=2;__VFP_FP__=1;__SIZEOF_PTRDIFF_T__=4;__LACCUM_EPSILON__=0x1P-31LK;__DEC32_SUBNORMAL_MIN__=0.000001E-95DF;__INT_FAST16_MAX__=0x7fffffff;__UINT_FAST32_MAX__=0xffffffffU;__UINT_LEAST64_TYPE__=long long unsigned int;__USACCUM_MAX__=0XFFFFP-8UHK;__SFRACT_EPSILON__=0x1P-7HR;__FLT_HAS_QUIET_NAN__=1;__FLT_MAX_10_EXP__=38;__LONG_MAX__=0x7fffffffL;__DEC128_SUBNORMAL_MIN__=0.000000000000000000000000000000001E-6143DL;__FLT_HAS_INFINITY__=1;__unix=1;__USA_FBIT__=16;__UINT_FAST16_TYPE__=unsigned int;__DEC64_MAX__=9.999999999999999E384DD;__ARM_32BIT_STATE=1;__CHAR16_TYPE__=short unsigned int;__PRAGMA_REDEFINE_EXTNAME=1;__INT_LEAST16_MAX__=0x7fff;__DEC64_MANT_DIG__=16;__INT64_MAX__=0x7fffffffffffffffLL;__UINT_LEAST32_MAX__=0xffffffffU;__SACCUM_FBIT__=7;__GCC_ATOMIC_LONG_LOCK_FREE=2;__INT_LEAST64_TYPE__=long long int;__ARM_FEATURE_CLZ=1;__INT16_TYPE__=short int;__INT_LEAST8_TYPE__=signed char;__SQ_FBIT__=31;__DEC32_MAX_EXP__=97;__ARM_ARCH_ISA_THUMB=2;__INT_FAST8_MAX__=0x7f;__ARM_ARCH=7;__INTPTR_MAX__=0x7fffffff;__QQ_FBIT__=7;__UTA_IBIT__=64;__LDBL_MANT_DIG__=53;__SFRACT_FBIT__=7;__SACCUM_MIN__=(-0X1P7HK-0X1P7HK);__DBL_HAS_QUIET_NAN__=1;__SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1);__INTPTR_TYPE__=int;__UINT16_TYPE__=short unsigned int;__WCHAR_TYPE__=unsigned int;__SIZEOF_FLOAT__=4;__USQ_FBIT__=32;__UINTPTR_MAX__=0xffffffffU;__DEC64_MIN_EXP__=(-382);__ULLACCUM_IBIT__=32;__INT_FAST64_MAX__=0x7fffffffffffffffLL;__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1;__FLT_DIG__=6;__UINT_FAST64_TYPE__=long long unsigned int;__INT_MAX__=0x7fffffff;__LACCUM_FBIT__=31;__USACCUM_MIN__=0.0UHK;__UHA_IBIT__=8;__INT64_TYPE__=long long int;__FLT_MAX_EXP__=128;__UTQ_IBIT__=0;__DBL_MANT_DIG__=53;__INT_LEAST64_MAX__=0x7fffffffffffffffLL;__GCC_ATOMIC_CHAR16_T_LOCK_FREE=2;__DEC64_MIN__=1E-383DD;__WINT_TYPE__=unsigned int;__UINT_LEAST32_TYPE__=unsigned int;__SIZEOF_SHORT__=2;__ULLFRACT_IBIT__=0;__LDBL_MIN_EXP__=(-1021);__arm__=1;__UDA_IBIT__=32;__INT_LEAST8_MAX__=0x7f;__LFRACT_FBIT__=31;__ARM_ARCH_7A__=1;__LDBL_MAX_10_EXP__=308;__ATOMIC_RELAXED=0;__ARM_FEATURE_SIMD32=1;__INT_LEAST32_TYPE__=int;__SIZEOF_WCHAR_T__=4;__UINT64_TYPE__=long long unsigned int;__LLFRACT_MAX__=0X7FFFFFFFFFFFFFFFP-63LLR;__TQ_FBIT__=127;__INT_FAST8_TYPE__=signed char;__ULLACCUM_EPSILON__=0x1P-32ULLK;__UHQ_IBIT__=0;__LLACCUM_IBIT__=32;__DBL_DECIMAL_DIG__=17;__DEC_EVAL_METHOD__=2;__TA_FBIT__=63;__UDQ_IBIT__=0;__ORDER_BIG_ENDIAN__=4321;__ACCUM_EPSILON__=0x1P-15K;__INTMAX_MAX__=0x7fffffffffffffffLL;__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__;__FLT_DENORM_MIN__=1.4012984643248171e-45F;__LLFRACT_IBIT__=0;__INT8_MAX__=0x7f;__UINT_FAST32_TYPE__=unsigned int;__CHAR32_TYPE__=unsigned int;__FLT_MAX__=3.4028234663852886e+38F;__USACCUM_FBIT__=8;__INT32_TYPE__=int;__SIZEOF_DOUBLE__=8;__FLT_MIN_10_EXP__=(-37);__UFRACT_EPSILON__=0x1P-16UR;__INTMAX_TYPE__=long long int;__DEC128_MAX_EXP__=6145;__ATOMIC_CONSUME=1;__GNUC_MINOR__=2;__UINTMAX_MAX__=0xffffffffffffffffULL;__DEC32_MANT_DIG__=7;__HA_FBIT__=7;__DBL_MAX_10_EXP__=308;__LDBL_DENORM_MIN__=4.9406564584124654e-324L;__STDC__=1;__PTRDIFF_TYPE__=int;__LLFRACT_MIN__=(-0.5LLR-0.5LLR);__ATOMIC_SEQ_CST=5;__DA_FBIT__=31;__UINT32_TYPE__=unsigned int;__UINTPTR_TYPE__=unsigned int;__USA_IBIT__=16;__DEC64_SUBNORMAL_MIN__=0.000000000000001E-383DD;__ARM_EABI__=1;__DEC128_MANT_DIG__=34;__LDBL_MIN_10_EXP__=(-307);__SIZEOF_LONG_LONG__=8;__ULACCUM_EPSILON__=0x1P-32ULK;__SACCUM_IBIT__=8;__GCC_ATOMIC_LLONG_LOCK_FREE=2;__LDBL_DIG__=15;__FLT_DECIMAL_DIG__=9;__UINT_FAST16_MAX__=0xffffffffU;__GCC_ATOMIC_SHORT_LOCK_FREE=2;__ULLFRACT_MAX__=0XFFFFFFFFFFFFFFFFP-64ULLR;__UINT_FAST8_TYPE__=unsigned char;__USFRACT_EPSILON__=0x1P-8UHR;__ULACCUM_FBIT__=32;__ARM_FEATURE_DSP=1;__QQ_IBIT__=0;__ATOMIC_ACQ_REL=4;__ATOMIC_RELEASE=3</PreprocessorDefinitions>
    <AdditionalIncludeDirectories>%(ClCompile.AdditionalIncludeDirectories);/usr/lib/gcc/arm-poky-linux-gnueabi/5.2.0/include;/usr/lib/gcc/arm-poky-linux-gnueabi/5.2.0/include-fixed;/usr/include</AdditionalIncludeDirectories>
    </ClCompile>
    </ItemGroup>

     

    I’m not sure what else to include, I am using VS intellisense, I am not using Clang.

    Attachments:
    You must be logged in to view attached files.
    #12842

    support
    Keymaster

    Hi,

    VS IntelliSense has its own logic for defining __cplusplus that is hard to control from the VisualGDB level. You could try overriding it by adding the following code to some common shared header:

    However this may cause strange IntelliSense errors as the VC++ IntelliSense is not 100% compatible with GCC-specific extensions. We generally recommend using Clang IntelliSense as it is specifically designed for better compatibility with GCC extensions.

    #12852

    AskingQuestions
    Participant

    This is frustrating but I’ll have to deal with it. It seems VS2017 should be updating __cplusplus whenever I change Properties>Configuration Properties>C/C++>Advanced>>Language Standard for C++ Files.

    #12853

    support
    Keymaster

    Hi,

    You could work around this with a relatively simple hack: create a file called cplusplus.h in your project directory with the following contents:

    then add the following code to your .vcxproj file:

    This will override the __cplusplus value used by IntelliSense, but won’t affect the actual build.

    BTW, feel free to let us know the reasons you don’t like Clang IntelliSense. We are constantly improving it and adding new usability features, so we always appreciate feedback on making it even better.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.