0

私は次の構造を持っています:

~/Desktop/hellonode$ ls 
build    rs232.h    testnode.js    helloworld.cc    helloworld.node    rs232.c

とでrs232.h

int OpenComport(int, int);

しかし、ノード ネイティブ プラグインを作成して次のコードを使用しようとすると、次のようになります。

#include "rs232.h"

using namespace v8;

void init(Handle<Object> target) {
  int cport_nr=0;        /* /dev/ttyS0 (COM1 on windows) */

  if(OpenComport(cport_nr, bdrate))
  {
    printf("Can not open comport\n");
    return;
  }

  target->Set(String::NewSymbol("hello"),
      FunctionTemplate::New(Method)->GetFunction());
}

node-waf を使用してプラグインをビルドします

すべてが正常にコンパイルされますが、実行しようとすると次のエラーが発生します。

~/Desktop/hellonode$ node testnode node: symbol lookup error: <~>/Desktop/hellonode/build/Release/helloworld.node: undefined symbol: OpenComport

4

1 に答える 1

1

これはリンク エラーであり、コンパイラ エラーではありません。OpenComportで定義されており、実行可能ファイルrs232.cにリンクしていますか?rs232.c

于 2012-04-14T15:39:40.380 に答える