Gcc

From Teknologisk videncenter
Revision as of 10:45, 21 December 2022 by Heth (talk | contribs) (C99)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

C99

Compile to binary using C99 pedantic preparred for GDB debugging

$gcc -ggdb -std=c99 -pedantic SOURCE.c -o BINFILE

Finding library gcc options

Find the necessary gcc options with pkg-config - example below.

heth@emb3:~$ pkg-config --libs --cflags dbus-1
-I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -ldbus-1
heth@emb3:~$ gcc dbus_ex.c -o dbus_ex -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -ldbus-1
 -OR-
heth@emb3:~$ gcc dbus_ex.c -o dbus_ex $(pkg-config --libs --cflags dbus-1)