Skip to content

[SofaCUDA] Enable preprocessor conformance mode with MSVC#6160

Merged
fredroy merged 1 commit into
sofa-framework:masterfrom
alxbilger:cudaflags
Jun 22, 2026
Merged

[SofaCUDA] Enable preprocessor conformance mode with MSVC#6160
fredroy merged 1 commit into
sofa-framework:masterfrom
alxbilger:cudaflags

Conversation

@alxbilger

@alxbilger alxbilger commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

With CUDA 13.3 et Visual Studio 18.7.1, I have the following error:

Error C1189 fatal: #error:  MSVC/cl.exe with traditional preprocessor is used. This may lead to unexpected compilation errors. Please switch to the standard conforming preprocessor by passing `/Zc:preprocessor` to cl.exe. You can define CCCL_IGNORE_MSVC_TRADITIONAL_PREPROCESSOR_WARNING to suppress this warning.

This is coming from C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\include\cccl\cuda\std\__cccl\preprocessor.h:

// Error when MSVC is used with the traditional preprocessor.
// We can't use `#pragma message` here because MSVC will encounter
// errors and exit before it processes pragma message directives.
#if defined(_MSC_VER) && !defined(__clang__)
#  if (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL == 1) \
    && !defined(CCCL_IGNORE_MSVC_TRADITIONAL_PREPROCESSOR_WARNING)
#    error \
MSVC/cl.exe with traditional preprocessor is used. This may lead to unexpected compilation errors. Please \
switch to the standard conforming preprocessor by passing `/Zc:preprocessor` to cl.exe. You can define \
CCCL_IGNORE_MSVC_TRADITIONAL_PREPROCESSOR_WARNING to suppress this warning.
#  endif // !defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL == 1
#endif // defined(_MSC_VER) && !defined(__clang__)

The solution has been found in the following PR: NVIDIA/cuda-samples#412
See the doc: https://learn.microsoft.com/en-us/cpp/build/reference/zc-preprocessor?view=msvc-170


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@alxbilger alxbilger added pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request labels Jun 19, 2026
@fredroy

fredroy commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Tested & approved 👍

@fredroy fredroy added the pr: fast merge Minor change that can be merged without waiting for the 7 review days label Jun 22, 2026
@fredroy fredroy added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Jun 22, 2026
@fredroy fredroy merged commit e3e24dc into sofa-framework:master Jun 22, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: fast merge Minor change that can be merged without waiting for the 7 review days pr: fix Fix a bug pr: status ready Approved a pull-request, ready to be squashed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants