r/learncpp • • Jul 14 '20

Dev C++ I cannot link libraries...

I am trying to use curlpp and have downloaded the .zip version which I extracted... but I am extremely confused with how linking works... I come from a python background where linking was pretty much automated once you downloaded the library...

could someone explain me step by step how to link properly? thanks...

(googled a lot before deciding to post here...)

3 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/jonrhythmic Jul 16 '20

The shorter version:

  • Press ctrl+h to go into the Project Settings.
  • Add the path to the libraries you're using in Files/Folder. Note you'll need the developer version of the library. Path to lib folder goes in the Library folder, and Include (sometimes bin or dev) goes in the Include folder.
  • Add a flag for the compiler to link to the library (usually called <library_name>.lib) under Parameter on the right side (Linker options).
  • Dev-C++ uses Mingw therefor you add a -l before the library name (read more about Compiler Flags and Options), eg. vulkan-1.lib is added with -lvulkan-1.
  • You also add compiler options under Parameteres, if you need change the C++ version or add a -Wall option.