Compile multiple C source fles into a unique object file

后端 未结 7 1660
再見小時候
再見小時候 2020-12-13 10:48

I have some C source files and I am using gcc. I basically want to compile all of them and create one single object file. When I try:

gcc -c src         


        
7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 11:21

    To combine multiple source files into a single object file (at least since gcc 4.1), use the compiler/linker option --combine

    (edit) later replaced with the compiler option -flto, with linking automatic depending on the compilation state: Requirements to use flto

提交回复
热议问题