0

Building a native module for Node.js under Cygwin / Windows:

I have a monkey.cc file with this:

#include <monkey/monkey.h>

running

node-waf configure build

I get the following

'configure' finished successfully (0.351s)
Waf: Entering directory `/usr/src/build'
[2/2] cxx_link: build/default/monkey_1.o -> build/default/monkey.node build/default/libmonkey.dll.a
Creating library file: default/libmonkey.dll.a

then the following error:

default/monkey_1.o:/usr/src/build/../monkey.cc:144: undefined reference to `_monkeyFoo'

monkeyFoo is defined in monkey.h which is in a directory named monkey. I am running the above command from the directory containing monkey directory and monkey.cc file.

EDIT:

wscript, which is the python script that node-waf runs looks like this:

import os

srcdir = '.'
blddir = './build'
VERSION = '0.0.2'

def set_options(opt):
  opt.tool_options('compiler_cxx')

def configure(conf):
  conf.check_tool('compiler_cxx')
  conf.check_tool('node_addon')

def build(bld):
  monkey = bld.new_task_gen('cxx', 'shlib', 'node_addon')
  monkey.cxxflags = ["-g", "-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE", "-Wall", "-L/usr/lib", "-lssl"]
  monkey.chmod = 0755
  monkey.target = 'monkey'
  monkey.source = 'monkey.cc'

What am I missing???

4

2 回答 2

3

那是链接器错误,而不是编译器错误。你有这个功能的定义吗?(不仅仅是一个声明。)你确定它被链接了吗?

于 2011-07-03T01:48:23.423 回答
0

monkey.lib='crypto'在 wscript 中添加。

于 2011-07-11T10:50:56.420 回答