Search code examples
cgcclinkerlibgcrypt

(Newbie) ld exit return 1, and libgcrypt


After much research, trying to find out how to link libraries to gcc, going to /usr/bin and /usr/lib confirming the stuff are there. When I try to compile my keygen file, this is the error it blurts out.

$ gcc keygen.c -W -Wall /usr/bin/libgcrypt-config
/usr/bin/libgcrypt-config: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status

I've been told by numerous sources that I should compile this way to check if libgcrypt installed correctly.

$ gcc -o foo foo.c 'libgcrypt-config --cflags --libs'

But everytime I try to do that this is what it blurts out:

gcc: error: libgcrypt-config --cflags --libs: No such file or directory

I've confirmed that libgcrypt20 and libgcrypt20-dev are installed using dpkg --get-selections>installed. But I am just so utterly confused as to what may be wrong.

Any form of help would be much appreciated.


Solution

  • Try:

    $ gcc -o foo foo.c `libgcrypt-config --cflags --libs`
    

    ` instead of '