Include a static library in Visual Studio Code debugger in C

Viewed 17

I’m trying to debug some C code, and I’ve got an issue to include my static library. Here is the error message:

Enter image description here

Here is a tree of my working directory:

.
├── Makefile
├── include
│   ├── my.h
│   └── script.h
├── lib
│   └── my
│       ├── Makefile
│       ├── include
│       │   ├── my.h
│       │   └── my_printf.h
│       ├── libmy.a
│       └── src
│           ├── my.h
│           ├── my_compute_power_rec.c
│           ├── my_compute_power_rec.o
│           ├── my_compute_square_root.c
│           ├── my_compute_square_root.o
│           ├── my_find_prime_sup.c
│           ├── my_find_prime_sup.o
│           ├── my_getnbr.c
│           ├── my_getnbr.o
│           ├── my_is_prime.c
│           ├── my_is_prime.o
│           ├── my_isneg.c
│           ├── my_isneg.o
│           ├── my_printf.c
│           ├── my_printf.h
│           ├── my_printf.o
│           ├── my_printf_base_process.c
│           ├── my_printf_base_process.o
│           ├── my_printf_flags.c
│           ├── my_printf_flags.o
│           ├── my_printf_identifiers.c
│           ├── my_printf_identifiers.o
│           ├── my_put_error.c
│           ├── my_put_error.o
│           ├── my_put_long_nbr.c
│           ├── my_put_long_nbr.o
│           ├── my_put_nbr.c
│           ├── my_put_nbr.o
│           ├── my_putchar.c
│           ├── my_putchar.o
│           ├── my_putstr.c
│           ├── my_putstr.o
│           ├── my_revstr.c
│           ├── my_revstr.o
│           ├── my_showmem.c
│           ├── my_showmem.o
│           ├── my_showstr.c
│           ├── my_showstr.o
│           ├── my_sort_int_array.c
│           ├── my_sort_int_array.o
│           ├── my_str_append_index.c
│           ├── my_str_append_index.o
│           ├── my_str_is_letter.c
│           ├── my_str_is_letter.o
│           ├── my_str_isalpha.c
│           ├── my_str_isalpha.o
│           ├── my_str_islower.c
│           ├── my_str_islower.o
│           ├── my_str_isnum.c
│           ├── my_str_isnum.o
│           ├── my_str_isprintable.c
│           ├── my_str_isprintable.o
│           ├── my_str_isupper.c
│           ├── my_str_isupper.o
│           ├── my_str_to_word_array.c
│           ├── my_str_to_word_array.o
│           ├── my_strcapitalize.c
│           ├── my_strcapitalize.o
│           ├── my_strcat.c
│           ├── my_strcat.o
│           ├── my_strcmp.c
│           ├── my_strcmp.o
│           ├── my_strcpy.c
│           ├── my_strcpy.o
│           ├── my_strlen.c
│           ├── my_strlen.o
│           ├── my_strlowcase.c
│           ├── my_strlowcase.o
│           ├── my_strncat.c
│           ├── my_strncat.o
│           ├── my_strncmp.c
│           ├── my_strncmp.o
│           ├── my_strncpy.c
│           ├── my_strncpy.o
│           ├── my_strstr.c
│           ├── my_strstr.o
│           ├── my_strupcase.c
│           ├── my_strupcase.o
│           ├── my_swap.c
│           └── my_swap.o
├── lib_file
├── new_lib_file
├── script
├── src
│   ├── main.c
│   ├── main.o
│   ├── script.c
│   └── script.o
└── tests
    └── test.c

And here is my tasks.json file:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe générer le fichier actif",
            "command": "C:\\MinGW\\bin\\gcc.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${workspaceFolder}\\lib\\my\\libmy.a",
                "${workspaceFolder}\\src\\main.c",
                "${workspaceFolder}\\src\\script.c",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "-I",
                "${workspaceFolder}\\include",
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Tâche générée par le débogueur."
        }
    ],
    "version": "2.0.0"
}

I don't really understand why isn't it working. I run my code on Windows WSL and I’m trying to debug it from Windows Visual Studio Code, so maybe there is a point here. Is there something wrong?

0 Answers
Related