Skip to content
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

vs2019 Exception support not detected #822

Closed
simoneperelli opened this issue Oct 13, 2020 · 1 comment
Closed

vs2019 Exception support not detected #822

simoneperelli opened this issue Oct 13, 2020 · 1 comment

Comments

@simoneperelli
Copy link

Hello there,

I recently dropped support for platforms other than Windows for a native module and now I get the following error building the solution on Visual Studio.

Exception support not detected. Define either NAPI_CPP_EXCEPTIONS or NAPI_DISABLE_CPP_EXCEPTIONS.

Running node-gyp rebuild from the command line works perfectly with no warnings.

I attach an example of my binding.gyp

{
  'includes': [],
  'targets': [
    {
      'target_name': 'addon',
      'configurations': {
        'Release': {  # Gyp is very picky about where this node lives within a target
          'msvs_settings': {
            'VCCLCompilerTool': {
              'FavorSizeOrSpeed': 2,  # Favor size over speed
              'Optimization': 1,  # Optimize for size
              'RuntimeLibrary': 2,  # Multi-threaded runtime dll,
              'ExceptionHandling': 1,  # Yes please
            },
            'VCLinkerTool': {
              'AdditionalOptions': [
                '/NODEFAULTLIB:mincore.lib',
              ]
            }
          }
        },
      },
      'sources': [
        'src/main.cpp',
      ],
      'defines': [
        'NOMINMAX',
        'UNICODE',
        'WIN32_LEAN_AND_MEAN',
        '_WIN32_WINNT=0x0603',
        '_HAS_EXCEPTIONS=1',
      ],
      'include_dirs': [
        '<!@(node -p "require(\'node-addon-api\').include")',
      ]
    }
  ]
}
@simoneperelli
Copy link
Author

Found solution digging around, leaving link here in case anyone bumps into the same problem
nodejs/node-gyp#26 (comment)

andrewdotn added a commit to andrewdotn/hfst-optimized-lookup that referenced this issue Jun 18, 2021
It still warns at build time, but no longer crashes at run time.

Relevant: nodejs/node-addon-api#822
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant