我正在尝试使用 VSCode(电子主进程,而不是渲染)调试我的电子锻造项目,但到处都是错误。我安装了electron-forge包含所有依赖项的包并初始化我的项目。
我遵循了这个指令,我launch.json的 VSCode 是:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron Main",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-forge-vscode-win.cmd",
"cwd": "${workspaceRoot}"
}
]
}
Run Code Online (Sandbox Code Playgroud)
但是当我F5在 VSCode 中进行调试时,我得到了Attribute "runtimeExecutable" does not exist因为electron-forge是全局安装的,所以node_modules/.bin/目录中没有这样的文件。
然后根据this我改变了"runtimeExecutable"我的launch.json如下:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron Main",
"runtimeExecutable": "electron-forge-vscode-win.cmd",
"cwd": "${workspaceRoot}"
}
]
}
Run Code Online (Sandbox Code Playgroud)
命令行是:
electron-forge-vscode-win.cmd --debug-brk=17423 --nolazy
? Locating Application …Run Code Online (Sandbox Code Playgroud) 我收到这个错误:
somedir/somefile.c: In function 'somefunc':
somedir/somefile.c:433:33: error: request for member '_file' in something not a
structure or union
ReturnValue->Val->Integer = _fileno(Param[0]->Val->Pointer);
^
Run Code Online (Sandbox Code Playgroud)
在尝试编译下一个代码时:
void somefunc(struct p *P, struct Value *ReturnValue, struct Value **Param, int n)
{
ReturnValue->Val->Integer = _fileno(Param[0]->Val->Pointer);
}
Run Code Online (Sandbox Code Playgroud)
ReturnValue是一个指向,struct Value并有一个指向union内部的指针int Integer
union SomeValue
{
int Integer;
void *Pointer;
}
struct Value
{
union SomeValue *Val;
}
Run Code Online (Sandbox Code Playgroud)
Param也很相似.我的意思是,一切似乎都是正确的,因为我还有另外一个像这样的功能,我没有任何错误,只有这个.怎么了?它与_fileno功能有关吗?当我换_fileno到时,会发生同样的事情fileno.