1

I want to use curl library with my c++ project in visual studio code and for that i successfully installed vcpkg library manager for c++ on my linux(ubuntu) system. and installed curl library with vcpkg but installed curl library i can't use include and other function in my c++ project all include file of curl library visual studio code can't detect.

Here following steps i performed to setup and install vcpkg and curl library.

  1. clone vcpkg repo https://github.com/Microsoft/vcpkg
  2. run this sh file for build package ./bootstrap-vcpkg.sh
  3. entered command for intergrate vcpkg with visual studio code "vcpkg integrate install"
  4. entered command for install curl library using vcpkg "vcpkg install curl"

this all above steps successfully performed without any error but still i can't able to recognise curl library in visual studio code with my c++ project.

I also tried with passing inlcude path of vcpkg with visual studio code task.json file in args

"args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}",
                "-I",
                "/home/kamlesh/vcpkg/installed/x64-linux/include",
                "-L" ,
                "/home/kamlesh/vcpkg/installed/x64-linux/lib"
                //"-lcurl"
            ],

when i pass include and library path with -I and -L parameter in args then project detect include file of curl library but compiler through undefined reference to function error

/usr/bin/ld: /tmp/ccG9QegR.o: in function `main':
/home/kamlesh/projects/curmmail/curlmail.cpp:17: undefined reference to `curl_easy_init'

Please help me how can i solve this issue for use curl library with vscode if there is something i m doing wrong or need to do anything extra or any other way to intergrate third party curl library with vscode c++ propject?

Kamlesh
  • 21
  • 4

1 Answers1

-1

I had a similar problem and noticed that this would only happen to my existing projects (before vcpkg).

Try creating a new solution and running some curl code in the new project within the new solution. That seemed to work for me.

starball
  • 20,030
  • 7
  • 43
  • 238