2012-08-02 94 views
0

如果我有这条线在make文件:\的Makefile -L命令

libpqxx_Libs = -L/share/home/cb -lpqxx-2.6.9 -lpq 

这是否表明编译器使用lpqxx-2.6.9.so共享对象文件或执行此indciate编译器使用foler lpqxx-2.6.9中的所有.so?或者这是另一回事?

感谢您的帮助!

回答

1

在这种情况下-L一种说法到连接,,增加了指定目录下的目录列表链接器将搜索必要的库,例如您使用-l指定的库。

这不是一个makefile命令,即使它通常出现在C项目的makefile中。

1

-L实际上并不是makefile命令(正如您在问题的标题中所述)。

实际发生在这条线上的是赋值给变量libpqxx_Libs - 没有什么更多也没有。您必须通过$(libpqxx_Libs)${libpqxx_Libs}在您的makefile中搜索使用该变量的位置。这很可能是链接命令或包含链接的编译命令中的一个参数。

在这方面,的-L-l的含义中可以找到,例如,gcc man pages,其中指出

-llibrary 
    Use the library named library when linking. 

    The linker searches a standard list of directories for the li- 
    brary, which is actually a file named `liblibrary.a'. The linker 
    then uses this file as if it had been specified precisely by 
    name. 

    The directories searched include several standard system direc- 
    tories plus any that you specify with `-L'.