Home > front end >  Using C libraries in VS Code (Winsock)
Using C libraries in VS Code (Winsock)

Time:05-10

I'm coding on Visual Studio for a simple UDP socket application on windows, for which I need the ws2_32.lib library. Now, in Visual Studio I'm using

#pragma comment (lib, "ws2_32.lib")

to link the needed library.

What about moving on VS Code? How can I use that library then? Aside from the C extension, do I need a particular compiler? Since the complete IDE essentially does all by itself, I'm pretty new to the problem.

Thank you in advance

CodePudding user response:

You can add properties in tasks.json in VS Code. This is the test demo DLLProject.lib

{
    "tasks": [
        {
            ...
            ...
            "args": [
                ......
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "${file}",
                "DLLProject.lib"
            ],

.CPP

#include"DLLProject.h"
  • Related