小编pro*_*ngo的帖子

当源路径中有空格时,VS Code 调试失败

我正在尝试在 VS Code(Windows)中为我的 c 文件创建一个 GDB 调试管道。你可以在下面找到我的 tasks.json 和 launch.json。

现在,如果我的源文件的路径不包含任何空格,这可以正常工作。但是,如果它确实包含空格,则每当调试器尝试中断时,我都会收到这样的消息: 无法打开“学期”:找不到文件

这是因为它要查找的源文件实际上位于

E:\Libraries\Dropbox\UNI\Semester 5\test.c

而且我猜要么 GDB 向 VS Code 发送了一个指向该文件的错误链接,要么 VS Code 不理解其文件路径中的空格(我对此表示怀疑)。抱歉,我不太了解调试会话期间 GDB 和 VS Code 之间的联系。

有谁知道如何解决这一问题?

任务.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build C Program",
            "type": "shell",
            "command": "gcc",
            "options": {"cwd": "${fileDirname}"},
            "args": [
                "-g", "-o", "${fileBasenameNoExtension}.exe", "${fileBasename}"
            ],
            "group": {"kind": "build","isDefault": true}
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

启动.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": …
Run Code Online (Sandbox Code Playgroud)

c windows debugging gdb visual-studio-code

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

使用brew在MacOS上安装php72

我正在尝试使用brew安装php72。

实际上,我brew install php72下载的是“ https://homebrew.bintray.com/bottles/php-7.3.0.mojave.bottle.tar.gz ”。

因此,当我检查php版本时,将向我显示PHP 7.3.0(cli)。

我如何才能完全安装php72而不是php73?

php homebrew php-7.2 php-7.3

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

如何使用 brew 在 mac os 上安装 ansible-galaxy?

是否可以在 mac os 上使用 brew 安装 ansible Galaxy?我试过:

$ brew install ansible-galaxy
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/cask-versions, homebrew/core and homebrew/cask).
==> Updated Formulae
git-lfs ?                cpprestsdk               exercism                 gobject-introspection    kube-aws                 minio-mc                 remarshal                teleport                 vegeta
ammonite-repl            ddgr                     fluent-bit               grpc                     libimagequant            nailgun                  root                     terraform_landscape      xsimd
angular-cli              dscanner                 fmt                      instead                  librealsense             node-build               serverless               tinyxml2                 you-get
arx                      duo_unix                 fruit                    ios-deploy               libsass                  opencv@2                 sfcgal                   tty-solitaire
conan                    elektra                  git-quick-stats          jdupes                   libvirt                  osrm-backend             snappystream             urdfdom_headers
console_bridge           ethereum                 gitbucket                kallisto                 minio                    parallelstl              sysdig                   vagrant-completion

Error: …
Run Code Online (Sandbox Code Playgroud)

homebrew ansible ansible-galaxy

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

C中的函数指针和内存地址

在以下程序中&foo,*foo和foo指向相同的内存地址:

#include <stdio.h>

int foo(int arg)
{
    printf("arg = %d\n", arg);
    return arg;
}

int main()
{
    foo(0); // ok
    (*foo)(0); // ok
    (&foo)(0); // ok

    printf("&foo = %lx\n", (size_t)(&foo));
    printf("foo = %lx\n", (size_t)(foo));
    printf("*foo = %lx\n", (size_t)(*foo));

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

输出为:

arg = 0
arg = 0
arg = 0
&foo = 55eeef54c720
foo = 55eeef54c720
*foo = 55eeef54c720
Run Code Online (Sandbox Code Playgroud)

有人可以解释吗?谢谢。

c linux gcc function-pointers

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