title: SHA1 library link not found using makefile
body: <p>I'm having trouble linking the sha library with my makefile while compiling.</p>
  
  <p>Here is my makefile:</p>
  
  <pre><code>CFLAGS= -g -Wall -Werror -std=c99 -pedantic 
  LDFLAGS=-lssl -lcrypto
  CC = gcc
  LD = gcc
  OBJS = dhtnode.o
  PROG = dhtnode
  
  .c.o:
  gcc $&lt; -o $@ $(CFLAGS)
  
  all: $(PROG)
  
  $(PROG): $(OBJS)
  $(LD) $(LDFLAGS) $(OBJS) -o $(PROG)
  
  dhtnode.o: dhtnode.c dhtpackettypes.h
  $(CC) $(CFLAGS) $(LDFLAGS) dhtnode.c
  
  clean:
  /bin/rm -f *.o dhtnode
  </code></pre>
  
  <p>My function using the lcrypto library is here:</p>
  
  <pre><code>#include &lt;openssl/sha.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdin.h&gt;
  //there are other includes but not concerning this part of the code
  
  char sha() {
  char *ibuf = malloc(sizeof(char));
  ibuf ="172.0.0.1:11112";
  char *obuf = malloc(SHA_DIGEST_LENGTH);
  
  SHA1((unsigned char*)ibuf, strlen(ibuf), (unsigned char*)obuf);
  int i;
  for (i = 0; i &lt; 20; i++) {
      printf("%x" , (unsigned char)obuf[i]);
      }
  printf("\n");
  
  return *ibuf;
  }
  </code></pre>
  
  <p>Here is the error I get when building with Eclipse:</p>
  
  <pre><code>C/p2p/dhtnode.c:107: undefined reference to `SHA1'
  </code></pre>
  
  <p>Can anybody tell my what is wrong with my makefile or possible eclipse settings?</p>
  
  <p>Thx in advance!</p>