[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

automatic link specification

From: AlfC
Subject: automatic link specification
Date: Sun, 16 Sep 2007 09:35:51 -0000
User-agent: G2/1.0


 Is there any way to tell g++ to link to specific libraries from
within the source code,

 for example if I use boost_filesystem functions I have to compile
using explicitly the -l option:
  g++ main.cpp -o main -lboost_filesystem

 this is very anoying if I have many different source files and I
don't want to remember which libraries have to be linked for each one
and I don't want to deal with makefiles.

 I am asking if the is a pragma or anything of this sort

//file main.cpp
#automatic_link_to boost_filesystem    <--- something like this
int main(){
  .. use boost::filesystem function..
 return 0;
//end of file

and then

  g++ main.cpp -o main

would "just work", without having to specify "-lboost_filesystem"
Is there something like this?

Thank you

reply via email to

[Prev in Thread] Current Thread [Next in Thread]