2013-06-17 1 views
5

nodejs 코드를 작성 중이며 컴파일 할 때 node-gyp을 사용하여 C++ 코드 ('mysql/mysql.h'가 포함 된 backend.cpp)를 사용하려고합니다. 건물 중이 오류가 발생합니다.node-gyp을 연결할 수 있도록 C++ 라이브러리를 포함시키는 방법은 무엇입니까?

module.js : 356 Module. 확장 프로그램 [extension] (this, filename); ^ 오류 : ____ /build/Release/backend.node : 정의되지 않은 심볼 : 반드시 mysql_init

사람이 도와 줄 수

? mysql.h를 대상 backend.node에 연결하도록 node-gyp에 어떻게 지시 할 수 있습니까?

답변

2

binding.gyp 파일의 libraries 목록에 추가 했습니까?

{ 
    "targets": [ 
    { 
     "target_name": "backend", 
     "sources": [<comma separated source names>], 
     "include_dirs":[<comma separated include dirs>], 
     "libraries": [<comma separated library paths>] 
    } 
    ] 
} 

당신은 또한 전체 Gyp Language Specification

+1

가 작동하지 않습니다 살펴 보셔야합니다 : 여기

짧은 예제 – innochenti