-static option for gcc?

后端 未结 2 618

I\'m wondering what the -static option on gcc does. I need this option when compiling a certain application, however when I do I get the following error:

gcc         


        
2条回答
  •  既然无缘
    2020-12-05 10:45

    The -static flag forces the linker to accept only static libraries and not any shared libraries.

    If you want to use -static, you have to ensure that you have a static version of the C library installed, which might be tricky to find (most systems do not have a static C library any more). Or you have to cancel the effect of -static. However, in the example, that would defeat the purpose of -static since the only library linked is (implicitly) the C library.

提交回复
热议问题