testSNL.c (inclullendo todos los archivos de cabecera necesarios)
- Código: Seleccionar todo
- #include <stdio>
 #include <string>
 #include <SNL>
este makefile es el que manda ejecutar el makefile que compila SNL y mueve el .a y el .h a la carpeta del sistema apropiada (y crea la carpeta SNL dentro de la que coloca el .h tal y como lo hace SDL)
- Código: Seleccionar todo
- all:
 @echo Compilando SNL
 $(MAKE) -C ./src/
 install:
 @echo Compilando SNL
 $(MAKE) -C ./src/
 @echo Copiando los archivos de SNL a las carpetas del sistema apropiadas
 mv ./lib/libSNL.a /usr/lib/
 mkdir /usr/include/SNL
 mv ./include/SNL/SNL.h /usr/include/SNL/
 @echo Compilando un programa de ejemplo
 $(MAKE) -C ./test/
 uninstall:
 @echo Eliminando los archivos de SNL del sistema
 $(RM) /usr/lib/libSNL.a
 $(RM) /usr/include/SNL/SNL.h
 rmdir /usr/include/SNL
Este es el makefile que se encarga de compilar el programa de ejemplo
- Código: Seleccionar todo
- #### Start of system configuration section. ####
 CC=gcc
 #### End of system configuration section. ####
 CFLAGS=-L/usr/lib -lSNL -I/usr/include/SNL
 testSNL: testSNL.o
 $(CC) $(CFLAGS) -o $@ $^
 testSNL.o: testSNL.c
 $(CC) $(CFLAGS) -c -o $@ $^
El error que recibo en la terminal al intentar compilar el programa de ejemplo es el siguiente:
- Código: Seleccionar todo
- gcc -L/usr/lib -lSNL -I/usr/include/SNL -c -o testSNL.o testSNL.c
 gcc -L/usr/lib -lSNL -I/usr/include/SNL -o testSNL testSNL.o
 testSNL.o: In function `main':
 testSNL.c:(.text+0x35): undefined reference to `informacion_biblioteca_SNL'
 testSNL.c:(.text+0x99): undefined reference to `SNL_DNS'
 testSNL.c:(.text+0xc0): undefined reference to `SNL_DNS_IPv4'
 testSNL.c:(.text+0x162): undefined reference to `SNL_conectar_TCP_IPv4'
 testSNL.c:(.text+0x186): undefined reference to `SNL_nuevo_grupo_conexiones'
 testSNL.c:(.text+0x19f): undefined reference to `SNL_nueva_conexion_grupo'
 testSNL.c:(.text+0x1c5): undefined reference to `SNL_enviar_grupo_TCP'
 testSNL.c:(.text+0x1e9): undefined reference to `SNL_tiempo_espera_grupo'
 testSNL.c:(.text+0x1f5): undefined reference to `SNL_comprobar_grupo_conexiones'
 testSNL.c:(.text+0x20b): undefined reference to `SNL_tiempo_espera_grupo'
 testSNL.c:(.text+0x229): undefined reference to `SNL_recibir_TCP'
 testSNL.c:(.text+0x24f): undefined reference to `SNL_comprobar_grupo_conexiones'
 testSNL.c:(.text+0x260): undefined reference to `SNL_conexion_activa_grupo_conexiones'
 testSNL.c:(.text+0x274): undefined reference to `SNL_cerrar_grupo_conexiones'
 testSNL.c:(.text+0x2a5): undefined reference to `EncriptarTexto_CifradoBitsIguales'
 collect2: ld devolvió el estado de salida 1
 make: *** [testSNL] Error 1
He comprobado si el makefile que instala SNL coloca correctamente los archivos y el archivo libSNL.a esta en /usr/lib por lo que esta en la localización correcta y SNL.h esta en /usr/include/SNL por lo que tambien esta en la localización correcta.
Gracias de antemano por la ayuda para poder compilar el programa de ejemplo y saber como compilar com SNL.
Edito:
He conseguido compilar el programa de ejemplo al final, lo uncico que hice fue quitar -lSNL de CFLAGS y ponerlo justo despues de testSNL.o del siguiente modo:
- Código: Seleccionar todo
- #### Start of system configuration section. ####
 CC=gcc
 #### End of system configuration section. ####
 CFLAGS=-L/usr/lib -I/usr/include/SNL
 testSNL: testSNL.o
 $(CC) $(CFLAGS) -o $@ $^ -lSNL
 testSNL.o: testSNL.c
 $(CC) $(CFLAGS) -c -o $@ $^
Una ultima pregunta, ¿por que me daba error al ponerlo como una justo despues de donde indicaba donde estaba el directorio con las bibliotecas (como hago cuando compilo con SDL)?



