Reputation: 23112
I'm currently trying to link a unit test using the boost unit testing framework. When it came to compiling my code, I immediately found myself googling "how to link boost unit tests", and sure enough, someone has had that same question.
But the fact that I've used a library for over a year now, frequently visit the documentation, and still don't know where to find the linker flags is a terrible thing. I've read the boost documentation which ostensibly answers this question, but didn't find the answer there.
If I want to build my program using boost library x
, how do I find out which flag to give the linker to actually link it?
Upvotes: 0
Views: 89
Reputation: 27577
Most Boost libraries are header only, so all you have to do is #include
them in your code and tell the compiler where to find them (-I
). For those that actually need linking, your linker flags are where to find the lib (-L
) and what to link (for library libx
use the linker flag -lx
)
Upvotes: 1