c++linuxgccboostg++

Assuming GCC and G++ are installed how to compile a file which uses boost library? (threading)


So I am new to linux stuff. I have set linux Debian up, I have gcc installed. I have a simple C++ file that uses boost threading library. Let us call that file example.cpp we have exect path to it. how to compile it? (sorry I came from windows world=)


Solution

  • Assuming example.cpp is in the current directory, this will create an executable called example, linked against boost-thread. g++ will search the system library locations for the library.

    g++ example.cpp -lboost-thread -o example