Gcc

From Teknologisk videncenter
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)