Skip to content

[SofaCUDA] Enable preprocessor conformance mode with MSVC#6160

Open
alxbilger wants to merge 1 commit into
sofa-framework:masterfrom
alxbilger:cudaflags
Open

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

Conversation

@alxbilger

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: 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant