On Sep 16, 9:09 am, Paul Pluzhnikov <[EMAIL PROTECTED]> wrote: > AlfC <[EMAIL PROTECTED]> writes: > > Is there any way to tell g++ to link to specific libraries from > > within the source code, > > No. > > Why do you think it's a good idea to be able to do this?
For example, suppose that you write a header file that uses boost_filesystem internally, from them on you will need *always* to compile with the option -lboost_filesystem. (at most you can specify different version of the file but it will be always something like this, there is not much variation from then on) Let's say that you give your source code that is "script-like" to someone else, she should know implementation details about some library called boost_filesystem that she never heard about and worst , the compilation gives awful errors messages about linking that don't help in figuring out to which object file to link. I could write a comment after "#include<boost/filesystem.hpp>" such as "/* don't forget to link to -lboost_filesystem*/" but then I thought, well, maybe gcc can do this for me and for the other user and I can just write "#include<boost/filesystem.hpp> #gcc_auto_link boost_filesystem". I don't know, I thought it could be easier for script-like programs, besides it is not standard, why do you think it is a *bad* idea to be able to do this? the closest I could get was to add a line "#warning 'remember to link to -lboost_filesystem'" just bellow some include line, but it is still annoying because the message still shows up when you do add the option -lboost_filesystem. Thanks for your response. Alfredo _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus