Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Debugging 在Visual Studio代码中使用Makefile调试现有项目_Debugging_Visual Studio Code_Makefile - Fatal编程技术网

Debugging 在Visual Studio代码中使用Makefile调试现有项目

Debugging 在Visual Studio代码中使用Makefile调试现有项目,debugging,visual-studio-code,makefile,Debugging,Visual Studio Code,Makefile,我正在尝试调试从Github下载的项目。通过命令行编译没有任何错误,我以这种方式执行项目: /final-i name-n2,一切正常。我打开了包含我的项目的文件夹,然后用Makefile调试我的项目。这是my launch.json的内容,但是当我点击debug时,我得到一个错误,即指定路径中的文件无效或丢失 "version": "0.2.0", "configurations": [ {

我正在尝试调试从Github下载的项目。通过命令行编译没有任何错误,我以这种方式执行项目:
/final-i name-n2
,一切正常。我打开了包含我的项目的文件夹,然后用Makefile调试我的项目。这是my launch.json的内容,但是当我点击debug时,我得到一个错误,即指定路径中的文件
无效或丢失

    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": " ${workspaceFolder}/final",
            "args": ["-i name", "-n 2"],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}
Makefile的内容太大,无法在这里发布,所以我只发布了第一行,表明
-g
在那里。 Makefile的第一行:

.SILENT:
.SUFFIXES: .cxx
.PHONY: library
CXXOBJECTS=final.o 
LIBOBJECTS= bunch of .o 
OBJECTS=$(CXXOBJECTS) $(LIBOBJECTS)
DEBUG=-g
OPT=-O3 -DNDEBUG -g
OPT_DEBUG=$(OPT) 
CXX_COMPILE=g++ -fopenmp -Wall -Wextra -fPIC $(OPT_DEBUG)  -I/Path  -I/usr/include/hdf5/serial $(EXTRAFLAGS)
CXX_LINK=g++ -fPIC $(EXTRAFLAGS) $(OPT_DEBUG)
THISDIR=/path 

这解决了我的问题。问题是我还需要修改tasks.json文件

为什么您认为从可视代码运行调试器与您的makefile有关?Makefiles用于编译项目。看起来这样做是正确的,结果是二进制运行。所以我认为makefile很好。如果您更具体地说明错误,可能会有所帮助:您说指定路径中的文件无效或丢失;哪个文件在哪个路径中?确切的错误消息是什么(请剪切并粘贴)?无法开始调试。程序路径
/home/user name/Project/final
缺失或无效。GDB失败,消息为:/home/user name/Project/final:没有这样的文件或目录。如果在流程启动后更改了流程的可执行文件,则可能会发生这种情况。例如,在安装更新时。尝试重新启动应用程序或重新启动机器。无法复制,我是这样键入的