Programación General > C/C++
Problema practica C
(1/1)
pancherre:
Hola buenas chicos es la primera vez que escribo aqui, asi que no se que tal se me dará jejeje. El caso es que tengo una practica que hacer que versa sobre la orden Grep de UNIX, y ya la tengo implementada y todo, he creado el makefile y eso, pero el problema es que me da es que cuando compilo el makefile me da "undefined reference to..." y ahi el nombre de una funcion. Estoy desesperado, no se que puede ser, os incluyo aqui el codigo a ver si me podeis echar una mano ok? Muchas gracias por adelantado!
Os pongo el makefile y el .h que uso por si es esto lo que falla
Makefile
--- Código: Text --- # Directorios de la aplicaciónINCLUDEDIR = ../includeLIBDIR = ../libBINDIR = ../bin # Programas estandar que se utilizan# ArchivadorAR = arAFLAGS = rs# CompiladorCC = gccCFLAGS = -I$(INCLUDEDIR) -L$(LIBDIR) # Biblioteca de usuario y ficheros que forman parte de la biblioteca BIBLIOTECA = $(LIBDIR)/libgrep_rw.a BIBLIOTECAB= $(LIBDIR)/libgrep_mmap.a #Programa ejecutable y ficheros que forman parte del mismo OBJETOS_PROGRAMA = grep.o #Objetivo "all" que programa los ejecutables y ficheros que forman partes del mismoall: $(BINDIR)/grep_mmap $(BINDIR)/grep_rw $(BINDIR)/grep_mmap: $(OBJETOS_PROGRAMA) $(BIBLIOTECAB) $(CC) $(OBJETOS_PROGRAMA) $(CFLAGS) -lgrep_mmap -Wall -o $(BINDIR)/grep_mmap $(BINDIR)/grep_rw: $(OBJETOS_PROGRAMA) $(BIBLIOTECA) $(CC) $(OBJETOS_PROGRAMA) $(CFLAGS) -lgrep_rw -Wall -o $(BINDIR)/grep_rw #Biblioteca que se crea $(BIBLIOTECA): grep_rw.o $(AR) $(AFLAGS) $(BIBLIOTECA) grep_rw.o$(BIBLIOTECAB): grep_mmap.o $(AR) $(AFLAGS) $(BIBLIOTECAB) grep_mmap.o$(OBJETOS_PROGRAMA) $(OBJETOS_BIBLIOTECA): $(INCLUDEDIR)/grep.h #Objetivo "prueba" con la prueba de los dos ejecutablesprueba: $(BINDIR)/grep_mmap $(BINDIR)/grep_rw ../bin/grep_rw include ~/Grep/src/grep_rw.c ../bin/grep_mmap include ~/Grep/src/grep_mmap.c
GREP.H
--- Código: Text --- #if !defined (_GREP_H_)#define _GREP_H_ # include <stdio.h># include <stdlib.h># include <fcntl.h># include <string.h># include <sys/stat.h># include <sys/types.h># include <sys/time.h># include <time.h># include <sched.h># include <dirent.h># include <unistd.h># include <sys/mman.h># include <unistd.h># include <fcntl.h> void proyectar (int ds,int argc, char *argv[],int i); void grep_rw(char *argv[],int ds,int i); int buscarpatron(char *texto,char *cadena,char *argv[],int w); #endif Estos son los programas, a las funciones que estan en grep.h se las hace referencia desde otros modulos, y creo que es ahí donde está el error.
pancherre:
Si necesitais algo mas avisadme, intentad ayudarme por favor!
m0skit0:
Vale, ¿pero qué función no está referenciada? Podrías empezar por eso.
Navegación
Ir a la versión completa