Skip to content

Build Error C4996 #12592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tero-paananen opened this issue Jan 11, 2024 · 6 comments
Closed

Build Error C4996 #12592

tero-paananen opened this issue Jan 11, 2024 · 6 comments
Labels

Comments

@tero-paananen
Copy link

tero-paananen commented Jan 11, 2024

Problem Description

I installed RNW via install script https://microsoft.github.io/react-native-windows/docs/rnw-dependencies on my new Windows 11 device. Script installed latest VS 2022 17.8.x with MSVC latest (14.38.x) and that MSVC is the problem with error

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error	C4996	'stdext::checked_array_iterator<T *>::pointer': 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.
        with
        [
            T=wchar_t
        ]	Microsoft.ReactNative	C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\__msvc_iter_core.hpp	491		

I did not managed to get event simple hello world to build.

Now i try to install older VS 2022 17.7.x with older MSVC 14.37.x to get project build. Let see how it goes.

Any help from @asklar ? I found this issue #6918

Steps To Reproduce

  1. Install latest VC 2022 into Windows 11
  2. Make RNW 0.71.x HelloWorld and try to build

Expected Results

No response

CLI version

npx react-native -v

Environment

System:
    OS: Windows 11 10.0.22621
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 16.86 GB / 31.71 GB
  Binaries:
    Node: 20.10.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.15 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.18362.0, 10.0.19041.0
  IDEs:
    Android Studio: Not Found
    Visual Studio: 16.11.31911.196 (Visual Studio Community 2019)
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: 0.71.13 => 0.71.13
    react-native-windows: 0.71.43 => 0.71.43
  npmGlobalPackages:
    *react-native*: Not Found
info React Native v0.73.2 is now available (your project is running on v0.71.13).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.73.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.71.13
info For more info, check out "https://reactnative.dev/docs/upgrading".

( I had VS 2022 uninstalled when i ran info command )

Target Platform Version

None

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

Snack, code example, screenshot, or link to a repository

No response

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) label Jan 11, 2024
@tero-paananen
Copy link
Author

tero-paananen commented Jan 11, 2024

I did not managed to install older VS 2022 17.7 Community version. Installing older versions seems to be supported only Pro and Enterprise. I remembered that i have somehow previously installed older VS versions but not managed now...so i have to continue with latest VS 2022 17.8.4

@tero-paananen
Copy link
Author

tero-paananen commented Jan 11, 2024

I managed to build project when adding compiler Preprocessor definitions flag _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS into following projects: Folly, Microsoft.ReactNative, fmt (example below).
PreprocessorDefinitions

But what would be the best solution for this? Can i set this flag for example somehow into ExperimentalFeatures.props ?

@asklar
Copy link
Member

asklar commented Jan 11, 2024

Hi @tero-paananen, I don't work on this project anymore but you are in good hands with @chrisglein's team :)

@chrisglein
Copy link
Member

Belief is that this was an issue that was fixed (warning looks familiar: #12411), but might not have been backported to 0.71 (it only made it to 0.72). Is it a requirement that you're on 0.71? Can you move to latest and get that fix?

@chrisglein chrisglein added Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) and removed Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) labels Jan 11, 2024
@tero-paananen
Copy link
Author

tero-paananen commented Jan 12, 2024

Latest (RNW 0.73.4) HelloWorld seems indeed not has this issue. I tested with this app:

npx react-native@latest init HelloLatest
cd HelloLatest
npx react-native-windows-init --overwrite --language cs
yarn install
npx react-native autolink-windows

I try to patch our current 0.71.x and continue with that still a while. I hope that patching only fmt (version & hash) would be enought.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 An issue that had been tagged "Needs: Author Feedback" has received activity (label applied by bot) and removed Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) labels Jan 12, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs: Attention 👋 An issue that had been tagged "Needs: Author Feedback" has received activity (label applied by bot) label Jan 12, 2024
@jonthysell
Copy link
Contributor

Finally fixed this with #13178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants