compilation - Makefile for a simple application -


i have file app.c uses 2 libraries gstreamer , libxml2. compile application type following on terminal

gcc -wall $(pkg-config --cflags --libs gstreamer-0.10) app.c -o app -i/usr/include/libxml2 -lxml2 

when try makefile contents follows :

all:         gcc -wall $(pkg-config --cflags --libs gstreamer-0.10) app.c -o app -i/usr/include/libxml2 -lxml2 run:         ./app clean:         rm app 

on running make command errors expected. significance of

$(pkg-config --cflags --libs gstreamer-0.10) 

on echoing above files when included in makefile gives me correct output.

pkg-config --cflags libraryx outputs path header files of libraryx. without this, compiler not know header files, , compilation fail.

similarly, pkg-config --libs libraryx outputs path actual compiled library files of libraryx. without this, linker not know library files, , linking fail.

pkg-config --cflags --libs libraryx combining described above. since you're using gcc both compilation , linking, pass parameters gcc.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -