我试图在Windows上使用VSCode和来调试fortran代码。我的问题是,我无法在VARIABLES窗口的Run and Debug选项卡中看到可分配变量的值。
VARIABLES窗口显示不可分配变量的值,但在可分配变量名称旁边显示An unspecified error has occurred。
我不确定这是否有帮助,但我添加了用于编译和调试代码的tasks.json和launch.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "build using intel fortran",
"type": "shell",
"options": {
"cwd": "${workspaceRoot}",
"env": {
"PATH": (copied and pasted PATH from echo %PATH% on Intel oneAPI command prompt for Intel 64 for Visual Studio2022)
"LIB": (copy and pasted LIB from echo %LIB% on Intel oneAPI command prompt for Intel 64 for Visual Studio2022)
"INCLUDE": (copy and pasted INCLUDE from echo %INCLUDE% on Intel oneAPI command prompt for Intel 64 for Visual Studio2022)
},
"shell": {
"executable": "${env:windir}\\system32\\cmd.exe",
"args": [
"/d",
"/c"
]
}
},
"command": "ifort.exe",
"args": [
"/debug:full",
"/o",
"${workspaceFolder}\\a_intel.exe",
"interface.f90",
"invert.f90",
"pvgauss.f90",
"main.f90"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"problemMatcher": []
}
]
}{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/a_intel.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "config",
"value": "Debug"
}
],
"console": "integratedTerminal"
}
]
}发布于 2022-11-05 14:59:23
恐怕您遇到了微软开发的Windows cppvsdbg的限制。我们没有任何控制的根本问题,英特尔将不得不采取行动,并提供一个调试适配器的Windows。
有关这个问题的更多信息,您可以阅读以下GitHub问题:https://github.com/fortran-lang/vscode-fortran-support/issues/310
您还可以在Fortran中跟踪这个线程以获得任何更新:https://fortran-lang.discourse.group/t/debugging-intel-compiled-code-on-windows-visual-studio-code/4426。
作为解决办法,您可以在VS代码中使用WSL和Intel的GDB调试器和cppgdb调试适配器。
我是现代Fortran for VS代码的作者之一
https://stackoverflow.com/questions/73143176
复制相似问题