C1083: Cannot open include file: 'napi.h': No such file or directory

Offen
#183 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
42/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
cpp, node.js
Bereich
build-system

Rechercherichtung

Start with the include and include_dir definitions in index.js and the example binding configuration shown in the issue. Reproduce the napi.h lookup on Windows and WSL, then verify that the chosen include path resolves napi.h correctly on both platforms.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

I get an error about not being able to find napi.h on Windows.

This only occurs when I use "include_dirs": ["<!@(node -p \"require('node-addon-api').include_dir\")"] versus "include_dirs": ["<!@(node -p \"require('node-addon-api').include\")"] (I was trying to use the former because in the index.js file it says the latter is deprecated.

The only difference I noticed is that inside the in the index.js file in the repo we have the include path in escaped quotes.

I've tried doing this as an experiment in another bindings repo and I found if I add the quotes to the include path it works versus without.

include: `"${__dirname}"`

versus

 include: `${__dirname}`

(The second one gives the error)

[Edit]: I just tried this on Linux (using WSL) and seems like I have the inverse problem...

fatal error: napi.h: No such file or directory
    4 | #include "napi.h"
      |          ^~~~~~~~
compilation terminated.
Vorherrschende Sprache
C++
Sterne
2.6k
Forks
602
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus nodejs/node-addon-examples

Alle Issues in nodejs/node-addon-examples

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.