Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.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
用C+调试Linux开发的Makefile项目+; < >我可以用C++调试Linux开发的控制台应用程序,但不能调试MaFe文件项目。未命中断点_Linux_Visual Studio 2015_Makefile_Remote Debugging - Fatal编程技术网

用C+调试Linux开发的Makefile项目+; < >我可以用C++调试Linux开发的控制台应用程序,但不能调试MaFe文件项目。未命中断点

用C+调试Linux开发的Makefile项目+; < >我可以用C++调试Linux开发的控制台应用程序,但不能调试MaFe文件项目。未命中断点,linux,visual-studio-2015,makefile,remote-debugging,Linux,Visual Studio 2015,Makefile,Remote Debugging,我的系统如下所示 10号窗口主页 Visual Studio社区2015更新3 Linux开发的Visual C++ VirtualBox 5.1.30 r118389(Qt5.6.2)-CentOS 7 1708 新项目-> Visual C++ +跨平台-> Linux ->控制台应用程序(Linux) 我可以创建一个项目,它工作得很好 但是,我无法调试makefile项目 我试了以下方法 创建项目 新项目-> Visual C++ +跨平台-> Linux > MaFrimeProj

我的系统如下所示

  • 10号窗口主页
  • Visual Studio社区2015更新3
  • Linux开发的Visual C++
  • VirtualBox 5.1.30 r118389(Qt5.6.2)-CentOS 7 1708

新项目-> Visual C++ +跨平台-> Linux ->控制台应用程序(Linux) 我可以创建一个项目,它工作得很好

但是,我无法调试makefile项目

我试了以下方法

  • 创建项目
    新项目-> Visual C++ +跨平台-> Linux > MaFrimeProject(Linux) 名称:项目1
    位置:D:\WorkSpace\TEST\u LINUX\
    解决方案名称:Project1

  • 添加源
    右键单击“我的项目(Project1(Linux))”->添加->新建项目…->C++文件(.CPP)
    名称:main.cpp
    D:\WorkSpace\TEST\u LINUX\Project1\Project1

  • 创建空的Makefile
    d:\WorkSpace\TEST\u LINUX\Project1\Project1\Makefile

  • all:
        gcc -o Project1 main.cpp
    
    clean:
        rm -rf Project1
    
  • 添加Makefile
    右键单击“我的项目(Project1(Linux))”->添加->现有项目…
    文件名:Makefile

  • all:
        gcc -o Project1 main.cpp
    
    clean:
        rm -rf Project1
    
  • 编辑main.cpp和Makefile

    all:
        gcc -o Project1 main.cpp
    
    clean:
        rm -rf Project1
    
    main.cpp

    #include <stdio.h>
    
    int main()
    {
        printf("Hello world 1\n");
        printf("Hello world 2\n");
        printf("Hello world 3\n");
        printf("Hello world 4\n");
        printf("Hello world 5\n");
    
        return 0;
    }
    
  • 配置属性 右键单击“我的项目(Project1(Linux))”->属性
    编辑配置属性->常规->远程生成根目录
    ~/projects
    ->
    /home/mike/projects

    编辑配置属性->远程生成->生成命令行
    ->
    cd$(RemoteRootDir)/$(ProjectName);全部生成

    编辑配置属性->远程生成->重新生成所有命令行
    ->
    cd$(RemoteRootDir)/$(ProjectName);清洁所有的

    编辑配置属性->远程生成->清除命令行
    ->
    cd$(RemoteRootDir)/$(ProjectName);保持清洁

    编辑配置属性->远程生成->输出
    ->
    $(RemoteRootDir)/$(ProjectName)/Project1

  • 断点
    将光标放在一行(“printf”(“Hello world 2\n”);“和“printf”(“Hello world 5\n”);)上,然后按F9

  • 调试
    单击“远程GDB调试器”

  • 输出窗口
    看到最后一行,这个程序运行良好,但调试不起作用

    输出->显示来自调试的输出

    =thread-group-added,id="i1"
    GNU gdb (GDB) 7.9
    Copyright (C) 2015 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "--host=i686-pc-mingw32 --target=x86_64-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word".
    Loaded 'shared libraries loaded at this time.'. Cannot find or open the symbol file.
    Stopped due to shared library event:
      Inferior loaded /lib64/libc.so.6
        /lib64/ld-linux-x86-64.so.2
    Loaded '/lib64/libc.so.6'. Cannot find or open the symbol file.
    Loaded '/lib64/ld-linux-x86-64.so.2'. Cannot find or open the symbol file.
    [Inferior 1 (process 8809) exited normally]
    The program '' has exited with code 0 (0x0).
    
    在Linux控制台窗口中按[Enter]

    Process /home/mike/projects/Project1/Project1 created; pid = 10152
    Listening on port 4444
    Remote debugging from host 127.0.0.1
    Hello world 1
    
    
    
    Hello world 2
    Hello world 3
    
    Process /home/mike/projects/Project1/Project1 created; pid = 10152
    Listening on port 4444
    Remote debugging from host 127.0.0.1
    Hello world 1
    
    
    
    Hello world 2
    Hello world 3
    
    
    
    Hello world 4
    Hello world 5
    
    Child exited with status 0
    GDBserver exiting
    
    在Linux控制台窗口中按[Enter]

    Process /home/mike/projects/Project1/Project1 created; pid = 10152
    Listening on port 4444
    Remote debugging from host 127.0.0.1
    Hello world 1
    
    
    
    Hello world 2
    Hello world 3
    
    Process /home/mike/projects/Project1/Project1 created; pid = 10152
    Listening on port 4444
    Remote debugging from host 127.0.0.1
    Hello world 1
    
    
    
    Hello world 2
    Hello world 3
    
    
    
    Hello world 4
    Hello world 5
    
    Child exited with status 0
    GDBserver exiting
    
  • 奇怪的事

  • 尽管我按了两次[Enter],调试还是完成了。
    在putty中运行程序并按[Enter]四次,程序完成

  • 断点是一个白点。
    单击“远程GDB调试器”之前,断点显示为红点。
    但单击[“远程GDB调试器”]后,断点显示为白点。
    白点的工具提示是“当前不会命中断点。包含此断点的模块尚未加载或无法获取断点地址。”

  • 每次,这个项目都过时了。
    每当我点击“远程GDB调试器”,对话框就会出现

    Microsoft Visual Studio
    This project is out of date
    Would you like to build it?
    
    我从不修改我的来源。它没有过时

  • 为了在Makefile项目(Linux)和控制台应用程序(Linux)中进行调试,我可以做些什么

    提前感谢您的感谢


    我给vccplinux发了邮件-support@microsoft.com但是被发回
    5505.4.1[vcclinux-support@microsoft.com]:收件人地址被拒绝:访问被拒绝[BL2NAM06FT015.Eop-nam06.prod.protection.outlook.com]

    我猜出来了。我比较了Console应用程序项目和Makefile项目。不同之处在于编译选项(-gdwarf-2)。