thanks! 
that‘s right, i add line 'libraries': ['-lX11'] into my binding.gyp that's 
ok!
new binding.gyp file  is:

{
  "targets":[
    {
      "target_name": "hcaptha",
      "sources": [ "addon/hcaptha.cc" ,"addon/cap.cc"],
      "cflags": ['-fexceptions','-O2','-Dcimg_use_png'],
      "cflags_cc": ['-fexceptions','-O2','-Dcimg_use_png'],
      "libraries":['-lX11']
    }
  ]
}


在 2013年1月15日星期二UTC+8下午3时54分18秒,Ben Noordhuis写道:
>
> On Tue, Jan 15, 2013 at 7:08 AM, zhonghua wu <[email protected]<javascript:>> 
> wrote: 
> > HI,ALL 
> > 
> > I want to use CImg library to deal images in node.js,so i write an node 
> > addon to do it. The compile is success, i run node-gyp build commond, 
> that's 
> > ok. 
> > 
> > But when i run the node program,the follow error occurs: 
> > 
> > [root@localhost hcaptha]# node index.js 
> > 
> > module.js:485 
> >   process.dlopen(filename, module.exports); 
> >           ^ 
> > Error: /usr/local/nodejs/hcaptha/build/Release/hcaptha.node: undefined 
> > symbol: XSendEvent 
> >     at Object.Module._extensions..node (module.js:485:11) 
> >     at Module.load (module.js:356:32) 
> >     at Function.Module._load (module.js:312:12) 
> >     at Module.require (module.js:362:17) 
> >     at require (module.js:378:17) 
> >     at Object.<anonymous> (/usr/local/nodejs/hcaptha/lib/hcap.js:1:75) 
> >     at Module._compile (module.js:449:26) 
> >     at Object.Module._extensions..js (module.js:467:10) 
> >     at Module.load (module.js:356:32) 
> >     at Function.Module._load (module.js:312:12) 
> > 
> > the binding.gyp file is: 
> > 
> > { 
> >   "targets":[ 
> >     { 
> >       "target_name": "hcaptha", 
> >       "sources": [ "addon/hcaptha.cc" ,"addon/cap.cc"], 
> >       'cflags': ['-fexceptions','-O2','-Dcimg_use_png'],//the configure 
> > using CImg lib 
> >       'cflags_cc': ['-fexceptions','-O2','-Dcimg_use_png'] 
> >     } 
> >   ] 
> > } 
> > 
> > cap.cc code: 
> > 
> > #include <node.h> 
> > #include <string> 
> > #include <iostream> 
> > #include "cap.h" 
> > #include "CImg-1.5.3/CImg.h" 
> > 
> > using namespace v8; 
> > Handle<Value> cap::create(const Arguments& args) {//create an image 
> >   HandleScope scope; 
> >     using namespace cimg_library; 
> >     CImg<unsigned char> captcha(256,64,1,3,0);//delete this line run ok! 
> >   return scope.Close(Boolean::New(1)); 
> > } 
> > cap::cap(){}; 
> > cap::~cap(){}; 
> > 
> > index.js code: 
> > 
> > var obj = require('../build/Release/hcaptha.node'); 
> > 
> > anyone can help me? 
>
> XSendEvent is an Xlib function.  You probably need to add a 
> 'libraries': ['-lX11'] line to your binding.gyp. 
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to