11

Decided to learn C++ to write a server daemon for Linux. That's going to be a nightmare. I haven't managed to do anything in 4 hours. How do I use external libraries?! 😭😭

Comments
  • 0
    Make sure they are in your PATH and in your code

    #include <libraryName.h>

    That should do it.
  • 0
    @iAmNaN so if an external library provides me cpp and hpp files I need to compile them first?
  • 0
    You need to have a .so or .la file (dynamic/static), make sure the lib folder is included using the -L compiler flag, headers included with the -I (capital i) compiler flag and the lib name without extension and lib prefix with -l (small l) flag. For example -l libpthread for a library named pthread.so.
    I wrote this from memory, you can fix me guys or you can just google it on SO
  • 0
    @Gianlu yes or compiled with your application
Add Comment