是什么-c paramater在GCC做 [英] what does -c paramater do in gcc

查看:117
本文介绍了是什么-c paramater在GCC做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道什么是 -c 标志 GCC做

例如,什么是

之间的区别

  GCC -c output0.c
VS GCC output0.c

我认识的第二个使 .A 文件,但我不知道什么是 .A 文件做

还有什么是 -o

 的gcc -o output0.o output0

这只是来命名输出文件吧?

有关GDB我有几个问题:


  • 设置中的断点的 GDB ? (打破主)?

  • GDB 运行output0(只是打字运行)?

  • 如何运行在一次单一的步骤? (只需输入步骤,然后继续把球击进?)


解决方案

  

-c


  
  

    

编译或汇编源文件,但不链接。链接
    阶段根本没有这样做。最终的输出是一个形式
    目标文件为每个源文件。


    
    

在默认情况下,对源文件的目标文件名是由制作
    更换后缀.C,.I,.S等,具有的.o。输入无法识别
    文件,不需要编译或组装,会被忽略。


  
  
  

-o文件


  
  

文件文件置入输出。不管这适用于任何类型的
  输出被产生的,无论是一个可执行文件,一个目的
  文件,汇编文件或preprocessed C $ C $℃。如果-o不
  指定,默认是把可执行文件a.out中,该
  目标文件在source.o source.suffix,其汇编文件
  source.s,一个precompiled头球source.suffix.gch文件,以及所有
  preprocessed在标准输出C源代码。


更可以发现 GCC手册

Does anyone know what does the -c flag do in gcc?

For example, what's the difference between

gcc -c output0.c
vs gcc output0.c

I know the second one makes a .a file but I don't what a .a file do.

Also what does the -o do in

gcc output0.o -o output0

It's just to name the output file right?

For gdb I have a few questions:

  • set a breakpoint inside the main inside gdb? (break main)?
  • run output0 inside gdb (just typing run)?
  • how to run it single steps at a time? (just type step and then keep hitting enter?)

解决方案

-c

Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.

By default, the object file name for a source file is made by replacing the suffix .c, .i, .s, etc., with .o. Unrecognized input files, not requiring compilation or assembly, are ignored.

-o file

Place output in file file. This applies regardless to whatever sort of output is being produced, whether it be an executable file, an object file, an assembler file or preprocessed C code. If -o is not specified, the default is to put an executable file in a.out, the object file for source.suffix in source.o, its assembler file in source.s, a precompiled header file in source.suffix.gch, and all preprocessed C source on standard output.

More can be found in GCC Manual Page

这篇关于是什么-c paramater在GCC做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆