Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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)

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted
  • --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.
share|improve this answer
    
Okay. It seems to make sense now –  Hello Jul 25 '12 at 4:45
add comment

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:~$
share|improve this answer
    
pkg-config --libs --cflags libcurl print the same thing as pkg-config --libs libcurl. When I enter pkg-config --cflags it prints nothing.The typo has been fixed. Hope that helps to understand my question better –  Hello Jul 22 '12 at 4:03
    
@Hello With the exception of a leading space, that's true. But your question doesn't say you ran pkg-config --libs libcurl. It says you ran pkg-config --cflags libcurl. As I've edited my question to show, the output of pkg-config --cflags libcurl is quite different from the output of pkg-config --libs --cflags libcurl. –  Eliah Kagan Jul 22 '12 at 4:10
    
I dont deny that. All I am trying to clarify here is what precisely is the point of using pkg-config --cflags when it prints nothing but an extra space –  Hello Jul 22 '12 at 4:45
    
@Hello That seems very different from what you seem to be asking in your question. You may want to edit your question again for clarification. Even reading these comments, I'm having trouble understanding what information you're asking for at this point. –  Eliah Kagan Jul 22 '12 at 10:22
    
@EliahKagan: Fixed title, question. see my answer for what I think he means. –  izx Jul 22 '12 at 10:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.