Hi All,

I'm trying to bind some c++ code I have written so it is accessible within 
node. I am working through the excellent 
https://github.com/nikhilm/jsfoo-pune-2012/blob/master/notes.txt.

Success so far:

I have set up a gyp file like this:

 {
  'targets': [
  {
  'target_name': 'simplefunctions',
  'sources': [
  'main.cc',
  'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\windows.h',
  ],
  },
  ],
 }

and compiled this OK:

 #include <v8.h>
 #include <node.h> 
 using namespace v8;
 
 Handle<Value> Square(const Arguments &args) {
     HandleScope scope;
 
     int a = args[0]->Int32Value();
      int sq = a * a;
 
     return scope.Close(Integer::New(sq));
 }
 
 extern "C" {
     static void Init(Handle<Object> target) {
         HandleScope scope;
 
         Handle<FunctionTemplate> squareTpl =
             FunctionTemplate::New(Square);
 
         target->Set(String::New("square"),
                     squareTpl->GetFunction());
     }
     NODE_MODULE(simplefunctions, Init)
 }
 
However when I add this to the 'sources' section: 

 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\windows.h',

and try to build it I get:

 gyp info it worked if it ends with ok
 gyp info using [email protected]
 gyp info using [email protected] | win32 | x64
 gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
 gyp info spawn args [ 'build/binding.sln',
 gyp info spawn args   '/clp:Verbosity=minimal',
 gyp info spawn args   '/nologo',
 gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
 G:\development\node 
binding\jsfoo-pune-2012-master\simplefunctions\build\simplefunctions.vcxproj(119,70):
 
error MSB4025: The pr
 oject file could not be loaded. '?', hexadecimal value 0x0B, is an invalid 
character. Line 119, position 70.
 gyp ERR! build error
 gyp ERR! stack Error: 
`C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with 
exit code: 1
 gyp ERR! stack     at ChildProcess.onExit 
(C:\Users\Edward\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:232:23)
 gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:99:17)
 gyp ERR! stack     at Process._handle.onexit (child_process.js:678:10)
 gyp ERR! System Windows_NT 6.1.7601
 gyp ERR! command "node" 
"C:\\Users\\Edward\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js"
 
"build"
 gyp ERR! cwd G:\Edward\01 Craft-e.com\02 Consulting\20 igloo\2012-10-03 - 
gaming system\development\node 
binding\jsfoo-pune-2012-master\simplefunctions
 gyp ERR! node -v v0.8.14
 gyp ERR! node-gyp -v v0.8.0
 gyp ERR! not ok
 
Not sure what I should do now so any help would be much appreciated.

Many thanks

-- 
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