4

I installed libcurl using :sudo apt-get install libcurl4-openssl-dev. When I try to compile my program I read that we have to pass where libcurl is located to the GCC compiler(although for me its located at /usr/include). Therefore according to http://ubuntuforums.org/showthread.php?t=1175115 I compiled it using

gcc myfile.c $(pkg-config --libs --cflags libcurl) -o myprogram

But if I only enter pkg-config --cflags libcurl it prints nothing (only a blank space). The program compiles correctly if I add the flag and --libs. I only do not understand why pkg-config --cflags libcurl returns nothing)

ish
  • 141,990
Hello
  • 63

2 Answers2

3
  • --cflags is intended to give you any pre-processor or compile flags required for the packages/libraries on the command-line; you get a blank space because there are no such required flags for libcurl; that's perfectly normal.
ish
  • 141,990
0

What exactly is the command that prints nothing?

You have pkg-config --libs --cflags libcurl in the $() in your gcc command, which you say works. But you've referred to the pkg-config command you're running to see the output as pkg-config --cflags libcurl without --libs.

Is it possible you're just running a different command inside the $() in the gcc command as you are separately to check the output?

To clarify, while the manpage is a bit confusing, the actual behavior of the two commands is different. This is from my Ubuntu 11.10 amd64 machine with libcurl4-openssl-dev installed:

ek@Apok:~$ pkg-config --libs --cflags libcurl
 -lcurl  
ek@Apok:~$ pkg-config --cflags libcurl

ek@Apok:~$
Eliah Kagan
  • 119,640