Editor highlights errors in nodejs addon project using cmake-js and Visual Studio compiler
Hi, am trying to get a good editor experience for C nodejs addon in CLion. I'm on Windows.
I've followed the instructions from Jetbrains to enable the experimental support for Visual Studio compiler. Seems ok.
I've configured the CMakeFiles.txt according to instructions from cmake-js project here: https://github.com/cmake-js/cmake-js. Project builds from command line. Here is the CMakeFiles.txt:
cmake_minimum_required(VERSION 3.7)
project (spirograph-shm)
include_directories(${CMAKE_JS_INC})
file(GLOB SOURCE_FILES "hello.cc")
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB})
I've added the vars used by this file, eg. CMAKE_JS_INC to the cmake command line options in IDEA.
Project builds fine in CLion too - whoop! The output in 'cmake-build-debug' differs slightly from the files generated in 'build' on the command line, but am going to ignore that for now.
In the IDE, not all header files from node/nan are parsed correctly, leading to lots of errors in the editor even though the project builds, eg:
I'd really like to get this working fully! My ultimate goal is to be able to switch between Windows version of my addon and Linux version.
Any help appreciated.
请先登录再写评论。
Hello Alfie did you ever get CLion to debug node addons. I'm on a mac but have similar questions.
Hello! Please take a look at this method of making of NodeJs addons - sing Nan and CMake: https://github.com/kjhe11e/NodeJsAddons. It provides a sample project (https://github.com/kjhe11e/NodeJsAddons/tree/master/UsingCmakeJs/Peripherals), maybe it will be helpful. As for the debug, please see https://stackoverflow.com/a/52437189.
How is this answered? 3 years ago? Am I the only person in the whole world who wanted to use CLion to develop C++ addon?