1

I want to know how to add external C library in visual studio code. I know this is a duplicated question but I can't find the breakthrough.

I read How to include needed C library using gcc?

and try

{
"version": "2.0.0",
"tasks": [
    {
        "type": "shell",
        "label": "build",
        "command": "C:\\MinGW\\bin\\gcc.exe",
        "args": [
            "-g",
            "${file}",
            "-o",
            "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "-L \\C:\\MinGW\\lib",
            "-l libws2_32.a"
        ],
        "options": {
            "cwd": "C:\\MinGW\\bin"
        },
        "problemMatcher": [
            "$gcc"
        ]
    }
]

but I got

c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -l libws2_32.a

collect2.exe: error: ld returned 1 exit status

and I installed GCC on C:\MinGW

Madeline
  • 43
  • 3
  • 5

0 Answers0