gcc -lcrypt-flag-Fehler in UNIX-C - Undefined Reference to crypt()

Benutze ich crypt() Funktion und die compile-flag namens -lcrypt das problem ist, dass der compiler sagt undefined reference to crypt(). Kann mir jemand sagen was ich falsch mache?

Makefile

    CC = gcc
    CFLAGS=-Wall -lm -lcrypt
    OBJS = get_passwords_hashed.o
    PROG = get_passwords_hashed.exe

    #adicionar or mudar o OBJS se tiver outras files para o programa


    #GENERIC

    all:    ${PROG}

    clean:
            rm ${OBJS} *~ ${PROG}

    ${PROG}: ${OBJS}
            ${CC} ${OBJS} -o $@

    .c.o:
            ${CC} $< -c -o $@
    # $@ - turns .c into .o 
    ###################################
    #dependencias
    so_final.o: get_passwords_hashed.c get_passwords_hashed.h

main.c

#include <stdio.h>
#include <string.h>
#include <crypt.h>

int testar_pass(char ant[],char (*pointer_hashes)[max_chars_string]){ //ponteiro para array de chars - char ** ant
     char * password ;
     char * encrypted;
     password = malloc(strlen(ant)*sizeof(char)); //password calculada recebida anteriror
     encrypted = malloc(strlen(ant)*sizeof(char));//hash
     strcpy(password,ant);
     encrypted = crypt(password,"10");
     if(strcmp(*pointer_hashes,encrypted) == 0){
         return 1;
         }
     else return 0;//devolve erro
}
  • Die Unix-version?
  • Sooooo viele dupes von dieser Frage SO...
InformationsquelleAutor exceltior | 2012-10-14
Schreibe einen Kommentar