views:

37

answers:

1

Hi,

I noticed that when linking boost libraries in VS2010, I only need to specify the linking directory, and the compiler automatically selects the right libary to link.

How can I do the same with my libraries?

+3  A: 

Visual C/C++ has a #pragma that allows you to 'insert' linker options, e.g.

#pragma comment(linker,"/DEFAULTLIB:myveryownlibrary.lib")

See http://msdn.microsoft.com/en-us/library/7f0aews7%28v=vs.71%29.aspx for more information (look for /DEFAULTLIB).

Patrick
Boost uses the more common #pragma comment(lib, "blah.lib") approach.
Hans Passant
OK Thank you. :)
You're right Hans. I overlooked the easier comment(lib,...) construction. Sometimes I tend to make things more complex than really needed.
Patrick