Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/152.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在构建具有依赖项的Linux共享库时跳过编译时符号解析_C++_Linux_Linker_Libraries_Shared - Fatal编程技术网

C++ 在构建具有依赖项的Linux共享库时跳过编译时符号解析

C++ 在构建具有依赖项的Linux共享库时跳过编译时符号解析,c++,linux,linker,libraries,shared,C++,Linux,Linker,Libraries,Shared,在构建共享库(取决于其他共享库)时,是否有gcc标志来跳过编译时链接器对符号的解析?由于某种原因,当我试图构建依赖于B.so和A.so的共享库C时,我的工具链给出了未定义的引用错误,即使依赖项已指定且存在。我听说存在一个gcc标志,用于将依赖项解析延迟到运行时。我想您正在寻找--允许未定义shlib。从: 允许未定义的符号是默认的,所以我猜你的问题实际上是不同的 --allow-shlib-undefined --no-allow-shlib-undefined Allows (the

在构建共享库(取决于其他共享库)时,是否有gcc标志来跳过编译时链接器对符号的解析?由于某种原因,当我试图构建依赖于B.so和A.so的共享库C时,我的工具链给出了
未定义的引用
错误,即使依赖项已指定且存在。我听说存在一个gcc标志,用于将依赖项解析延迟到运行时。

我想您正在寻找
--允许未定义shlib
。从:

允许未定义的符号是默认的,所以我猜你的问题实际上是不同的

--allow-shlib-undefined
--no-allow-shlib-undefined
    Allows (the default) or disallows undefined symbols in shared libraries. 
    This switch is similar to --no-undefined except that it determines the 
    behaviour when the undefined symbols are in a shared library rather than 
    a regular object file. It does not affect how undefined symbols in regular
    object files are handled.

    The reason that --allow-shlib-undefined is the default is that the shared
    library being specified at link time may not be the same as the one that 
    is available at load time, so the symbols might actually be resolvable at 
    load time. Plus there are some systems, (eg BeOS) where undefined symbols 
    in shared libraries is normal. (The kernel patches them at load time to 
    select which function is most appropriate for the current architecture. 
    This is used for example to dynamically select an appropriate memset 
    function). Apparently it is also normal for HPPA shared libraries to have
    undefined symbols.