GithubHelp home page GithubHelp logo

Comments (15)

michaelrgibbs avatar michaelrgibbs commented on May 27, 2024 32

This is now a problem in VS2022 17.8.0 which was released today.

from cpprestsdk.

joshuayoes avatar joshuayoes commented on May 27, 2024 5

ChatGPT response for how to apply _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING for all solutions in Visual Studio 17.8.4 that worked for me.


Using Property Sheets in Visual Studio is a good way to apply settings like preprocessor definitions across multiple projects. Here's a step-by-step guide on how to create and apply a Property Sheet for the _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING preprocessor definition:

Creating a Property Sheet

  1. Open Visual Studio and a Project: Start by opening one of your projects in Visual Studio.

  2. Open Property Manager: Go to View > Other Windows > Property Manager. This will open the Property Manager window, which lists all your projects and their respective property sheets.

  3. Add New Property Sheet:

    • Right-click on one of your projects in the Property Manager and choose Add New Property Sheet....
    • Give it a name, like GlobalSuppressions.props, and save it in a common location where it can be accessed by all projects.
  4. Edit the Property Sheet:

    • Once the property sheet is created, it will appear under the project in the Property Manager. Right-click on it and select Properties.
    • In the Property Pages dialog, navigate to C/C++ > Preprocessor.
    • Under Preprocessor Definitions, click on the dropdown and select <Edit...>.
    • Add _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING to the list. Click OK.
  5. Save: Save the changes and close the property sheet properties.

Applying the Property Sheet to Other Projects

  1. Open Other Projects: Open another project where you want to apply this property sheet.

  2. Use Property Manager:

    • Again, go to View > Other Windows > Property Manager.
    • Right-click on the project in the Property Manager.
  3. Add Existing Property Sheet:

    • Choose Add Existing Property Sheet....
    • Navigate to the location where you saved GlobalSuppressions.props and select it.
  4. Apply and Repeat: The property sheet is now applied to this project. Repeat this step for each project where you want to apply the preprocessor definition.

Notes

  • Consistency: Ensure that all projects that need the preprocessor definition have the property sheet applied.
  • Source Control: If you're using source control, remember to add the property sheet file to your repository.
  • Updates: Any changes made to the property sheet will automatically apply to all projects that include it.

This approach centralizes certain settings, making them easier to manage across multiple projects. It's especially useful in larger solutions with many projects.

from cpprestsdk.

ssingh-facilgo avatar ssingh-facilgo commented on May 27, 2024 1

This is now a problem in VS2022 17.8.0 which was released today.

same happen with vs2022 17.8.3

from cpprestsdk.

joshuayoes avatar joshuayoes commented on May 27, 2024 1

These are the steps I followed and the solution worked for. I am doing a React Native for Windows project.

This is the key part, each solution that uses C++ needs _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING in Properties > C/C++ > Preprocessor > Preprocessor Definitions in order to compile:

Example of how to get to properties on a solution:
Screenshot 2024-01-12 at 12 27 18 PM

Example of setting being applied:
Screenshot 2024-01-12 at 12 25 21 PM

I choose to do this via Property Sheets but you could also manually go through each solution.

from cpprestsdk.

joshuayoes avatar joshuayoes commented on May 27, 2024 1

I added GlobalSupressions.prop to my ~/<PROJECT>/windows/<APPNAME> directory

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets" />
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup />
  <ItemDefinitionGroup>
    <ClCompile>
      <PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions);_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING;</PreprocessorDefinitions>
    </ClCompile>
  </ItemDefinitionGroup>
  <ItemGroup />
</Project>

Then I added clicked Add Existing Property Sheet to each C++ solution

Screenshot 2024-01-12 at 12 31 31 PM

and navigated to the path of my ~/<PROJECT>/windows/<APPNAME>/GlobalSupressions.prop.

Screenshot 2024-01-12 at 12 32 20 PM

I did this for each solution and then it would compile both via the play button in Visual Studio and via npx react-native run-windows


I'm sure there is a better way to do this, but I am not a C++ developer and this was the first option that worked for me.

from cpprestsdk.

frederick-vs-ja avatar frederick-vs-ja commented on May 27, 2024

I'd like to copy the definition of checked_array_iterator into cpprestsdk's header (with de-_Uglification), if we don't want to rely on GSL or C++20 (for span).

from cpprestsdk.

dylanclark avatar dylanclark commented on May 27, 2024

Is there a path forward to getting this fix merged? If not, would a patch to silence the warning be welcomed in the vcpkg portfile for cpprestsdk? A number of projects I've worked on consume cpprestsdk from vcpkg. They treat warnings as errors and have had to silence the deprecation warning with the new compiler update.

from cpprestsdk.

OliverGlandberger avatar OliverGlandberger commented on May 27, 2024

For what it's worth, this is still an issue for us, and our current work around (for the poor souls unfortunate enough to have upgraded VS 2022 early), is to replace this (line 404 in containerstream.h):

std::copy(readBegin, readEnd, stdext::checked_array_iterator<_CharType*>(ptr, count));

To this:

std::span<_CharType> data_span(readBegin, readEnd);
std::copy(data_span.begin(), data_span.end(), ptr);

Remember to add include <span> as well, and you might have to modify the second std::copy below under the neighboring #else.

from cpprestsdk.

ssingh-facilgo avatar ssingh-facilgo commented on May 27, 2024

Hey @OliverGlandberger , i have issue :

Build failed with message C:\Users\ssing\Documents\Mobile_faciligo\facilgo-sales-app\node_modules.fmt\fmt-8.0.0\include\fmt\format.h(341,51): error C4996: 'stdext::checked_array_iterator<T*>': warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions and will be removed in the future. std::span (since C++20) and gsl::span can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning. [C:\Users\ssing\Documents\Mobile_faciligo\facilgo-sales-app\node_modules\react-native-windows\fmt\fmt.vcxproj]. Check your build configuration.
Command failed. Re-run the command with --logging for more information.

is there any solution for this?

from cpprestsdk.

robsadams avatar robsadams commented on May 27, 2024

Hey @OliverGlandberger , where is containerstream.h located? In my project, this file does not exist in Android.

from cpprestsdk.

hypetsch avatar hypetsch commented on May 27, 2024

We are facing the same issue. A solution other than having to ignore the warning would be required.

from cpprestsdk.

robsadams avatar robsadams commented on May 27, 2024

Thanks @joshuayoes but this does not work..... when you open property manager, it says that there are no c/c++ projects and does not list my project in the property manager window so I can't click on it and add a property sheet. I believe this is because my project is react-native/javascript. Any ideas?

from cpprestsdk.

skycat2216 avatar skycat2216 commented on May 27, 2024

17.8.6
No official fix for it
jezz, Microsoft

from cpprestsdk.

trasa avatar trasa commented on May 27, 2024

Reproduced in 17.9.1

from cpprestsdk.

RooTender avatar RooTender commented on May 27, 2024

Same stuff in 17.9.6

from cpprestsdk.

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.