Pregunta

recently I've been learning how to program GTK+ applications and MySQL in C programming language.

I wanted to try writing a program with both of those libs at once, I've done it but I can't compile it...

When I compile a program which uses MySQL I do this:

    gcc exa_7.c -o exa_7 -std=c99  `mysql_config --cflags --libs`

and when I compile GTK+ application I do this:

    gcc -o test_5 test_5.c `pkg-config --libs --cflags gtk+-2.0`

I can't write both of them, I mean pkg-config and mysql_config at once, because compiler won't accept it. I've been trying to find some makefile scripts but haven't found anything usefull. Please help. Thanks.

¿Fue útil?

Solución

You're supposed to do this:

gcc exa_7.c -o exa_7 -std=c99  `mysql_config --cflags --libs` `pkg-config --libs --cflags gtk+-2.0`

If the backticks are causing you problems, you can run the programs using $() instead:

gcc exa_7.c -o exa_7 -std=c99  $(mysql_config --cflags --libs) $(pkg-config --libs --cflags gtk+-2.0)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top