코딩Coding/make★gcc★&g++★clang★compiler

C언어에서 gcc -Wall -save-temps main.c 하면 나오는 파일들main.o / main.i / main.s

내인생PLUS 2022. 1. 27. 10:54
728x90

10분59초에 나옴
gcc -Wall -save-temps main.c -o harry


하면
파일이
main.o
main.i
main.s

파일들에 대해서


https://youtu.be/5SIBB589fAg



다른 출처 stackoverflow
https://stackoverflow.com/questions/25137743/where-do-we-use-i-files-and-how-do-we-generate-them

Where do we use .i files and how do we generate them?

I was going through the GCC man page, I found the following line: file.i C source code that should not be preprocessed. I know that running gcc -E foo.c stops the compiler after

stackoverflow.com



foo # compiled binary program (AKA: combined "object file",
# "executable", "binary", "program", or "machine code")

foo.i # intermediate, preprocessed C file

foo.o # individual object file

foo.s # assembly file


https://stackoverflow.com/questions/25137743/where-do-we-use-i-files-and-how-do-we-generate-them


main.o


A file ending in .o is an object file. The compiler creates an object file for each source file, before linking them together, into the final executable.

# individual object file




main.i
foo.i



# intermediate, preprocessed C file







main.s


.S files are source code files written in assembly
어셈블리어 파일

# assembly file
















https://www.geeksforgeeks.org/types-of-c-files-after-its-compilation/

Types of C files after its compilation - GeeksforGeeks

A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

www.geeksforgeeks.org





What are .o files?
https://stackoverflow.com/questions/2186246/what-is-o-file

What is *.o file?

I'm compiling own project. And it halted by this error: LINK||fatal error LNK1181: cannot open input file 'obj\win\release\src\lua\bindings.o'| Compiling using Code::Blocks with VS 2005/2008

stackoverflow.com



What are .i files?
https://pvs-studio.com/en/blog/terms/0076/

Preprocessed *.i file

A preprocessed *.i file is an output of the C or C++ preprocessor. It is usually this extension which is characteristic of files created as the preprocessor output. The preprocessor performs primary transformations of the source program text using only lex

pvs-studio.com




.s
.S files are source code files written in assembly

https://stackoverflow.com/questions/10285410/what-are-s-files/51110745

What are .S files?

I've seen .S files in various projects such as in the Linux Kernel, FreeBSD kernel, or in some other projects. What do these files do and why can't we have .c files instead ?

stackoverflow.com




반응형