MSVC supports the following pragma, which can be used to automatically link a library when a header file is included. This is used by for example Boost.
#pragma comment(lib, "requiredLibrary.lib") Unfortunately, g++ doesn't support this. Could you add it? -- Summary: Support for automatic linking via pragma Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: olafvdspek at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39437