How can I make gcc do this…
This post will be dedicated to gcc’s command line options and various other questions related to compiling/building your code with gcc. For example…
——————–
How can I get gcc to generate assembly code for my C file:
gcc -O2 -S -c foo.c
——————–
How can I tell gcc to generate an assembly listing? (that is C and ASM instructions interspersed, and also displaying the byte offsets and line numbers):
gcc -c -g -Wa,-a,-ad $(DCEAPP_CFLAGS) db.c > db.LST
——————–
To test if my 64-bit gcc can produce 32-bit binaries:
gcc -m32 -pedantic-errors -std=c89 -Wall hello-world.c
——————–
To trace where the headers files are included from:
Option 1: Output a list of headers included (full paths):
gcc -c -M test.c &> gcc-output.txt
Option 2: Actual trace output, showing which headers include which other headers
gcc -c -E -x c - -v < test.c &> gcc-output.txt
gcc -c -E -x c++ - -v < test.cpp &> gcc-output.txt
2 Responses to How can I make gcc do this…
Leave a Reply Cancel reply
-
Categories
- Android Development
- Bash
- C programming
- dpkg/apt-get
- drupal
- Emacs
- Git
- Java
- Linux administration
- Linux device drivers
- Linux Gaming
- Linux kernel
- Linux Networking
- Linux on Windows
- Linux printing
- Linux sound and ALSA
- Package Managers
- Programming
- RPM
- Shell and environment
- Tips and tricks
- Uncategorized
- VirtualBox
- Virtualization
- web development
- wine
- WMaker
- Wordpress Tips
- X Window System
- XFCE
-
Articles
- August 2020
- August 2019
- May 2019
- July 2017
- February 2017
- January 2017
- November 2016
- October 2016
- September 2016
- August 2016
- July 2016
- June 2016
- April 2016
- March 2016
- December 2015
- November 2015
- September 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- October 2014
- February 2014
- January 2014
- November 2013
- October 2013
- June 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- October 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- September 2011
- August 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
-
Meta
Cloud
audio bash boot compile C programming cups drupal emacs etc Fedora git grep how to httpd init kernel libc linux linux partition localtime login make mount mp3 mysql networking oracle package managers password phpMyAdmin programming rpm shell sql vbox version control system virtual box vm web server wordpress www xargs xfce xwin yum
To see default include and lib directories:
gcc -v source_file.c
The key part is giving it a source file (any C file) – otherwise it will only print version info and exit.
To install all of the dev tools for your architecture in Fedora:
yum install @development-tools