小编Jak*_*ake的帖子

使用node-gyp构建时无法加载node.js本机插件,但在使用Visual Studio构建时它可以正常工作

我为node.js编写了一个本机插件,使用没有node-gyp的MSVC++编译它,并在节点REPL和应用程序中成功使用它.我正在使用x64节点并编译x64插件.我正试图用node-gyp来构建东西.我已经获得了node-gyp来生成Visual Studio解决方案并对其进行编译,但是出来的插件不起作用.我得到的唯一错误是:

Error: The specified procedure could not be found.

    at Object.Module._extensions..node (module.js:480: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 repl:1:13
    at REPLServer.self.eval (repl.js:111:21)
    at rli.on.e (repl.js:260:20)
    at REPLServer.self.eval (repl.js:118:5)
    at Interface.<anonymous> (repl.js:250:12)
Run Code Online (Sandbox Code Playgroud)

当我运行一个试图加载插件的脚本时,我得到了这个:

module.js:480
  process.dlopen(filename, module.exports);
          ^
Error: The specified procedure could not be found.

    at Object.Module._extensions..node (module.js:480: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> (c:\blah\testheaders.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 …
Run Code Online (Sandbox Code Playgroud)

c++ native add-on node.js

6
推荐指数
1
解决办法
4763
查看次数

新的 MinGW gcc 不做任何事情

我正在尝试在 Windows 上编译一个简单的helloworld程序MinGW,但没有任何反应。没有输出,没有可执行文件,什么都没有。我刚刚用他们的mingw-get-inst-20120421.exe安装程序安装了最新的 MinGW 。当我使用随附的旧版 MinGW 时Code::Blocks,我能够编译该程序。我没有想法,我的谷歌搜索是徒劳的。C:\MinGW\bin 在我的路径上,我正在使用 MSYS。

MSYS中的命令行参数:

gcc helloworld.c -o helloworld
Run Code Online (Sandbox Code Playgroud)

c c++ mingw

5
推荐指数
1
解决办法
5075
查看次数

有没有办法在没有辅助函数的情况下在Haskell中轻松构造重复元素列表?

给定类型的元组(Int, a),例如(n,c),我希望构造一个列表[a],其中该元件c被重复n多次,即,(4, 'b')变为"bbbb".我目前的解决方案如下:

decode :: (Int, a) -> [a]
decode (n, a) = map (\x -> a) [1..n]
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,我正在映射一个匿名函数,该函数总是返回a一个n元素列表,即前n个正整数.有没有更有效的方法来做到这一点?我对构建整数列表并从不使用它感到很难过.另一种解决方案是使用辅助函数并递归n,但这看起来很混乱并且过于复杂.是否有类似于以下python代码的东西?

'b'*4
Run Code Online (Sandbox Code Playgroud)

haskell functional-programming list

3
推荐指数
3
解决办法
294
查看次数

谷歌地图API,所有标记打开相同的infowindow

我有一个页面可以检索一堆位置和一些有关其相关标记的数据,并将它们放在Google Maps地图上.每个人都应该在点击时弹出自己的小消息.但是,单击其中任何一个会使最近添加的消息弹出最近添加的标记.是什么赋予了?我没有正确编写Click事件的脚本吗?这是相关的代码:

var xmlDoc;
    if (window.XMLHttpRequest)
    {
    xmlDoc=new window.XMLHttpRequest();
    xmlDoc.open("GET","locs.php",false);
    xmlDoc.send("");
    xmlDoc=xmlDoc.responseXML;
    }
    // IE 5 and IE 6
    else if (ActiveXObject("Microsoft.XMLDOM"))
    {
    xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async=false;
    xmlDoc.load("locs.php");
    }

    var pins = xmlDoc.getElementsByTagName("pin");
    //alert(pins);

    for (i=0;i<pins.length;i++)
    {
       //alert(pins[i].getElementsByTagName("lat")[0].childNodes[0].nodeValue);
       var point = new GLatLng( pins[i].getElementsByTagName("lat")[0].childNodes[0].nodeValue, 
                                pins[i].getElementsByTagName("lon")[0].childNodes[0].nodeValue);
       var colord;
       var curgender = pins[i].getElementsByTagName("gender")[0].childNodes[0].nodeValue;
       if(curgender == "Male")
       {colord = blueOpt;}else if(curgender=="Female"){colord = pinkOpt;}else{colord = purpleOpt;}

       var marker = new GMarker(point, colord);
       var mess =  pins[i].getElementsByTagName("message")[0].childNodes[0].nodeValue;

       GEvent.addListener(marker, "click", function() {
         marker.openInfoWindowHtml(mess);
       });

       map.addOverlay(marker);

    }
  }
Run Code Online (Sandbox Code Playgroud)

javascript google-maps

1
推荐指数
1
解决办法
3987
查看次数