Newsgroup: it.comp.programmare
Titolo: Problemi di compilazione socket (con kdevelop)

Ciao a tutti,
sto scrivendo un programmino che usa i socket con Kdevelop, ma comincio ad avere qualche problema
nella compilazione...
Sembra tutto a posto (saranno al massimo 100 righe di codice), ma quando cerco di fare il make
Kdevelop mi da i seguenti errori:
gmake all-recursive
gmake[1]: Entering directory `/mnt/home/univ/labreti/ftp'
Making all in ftp
gmake[2]: Entering directory `/mnt/home/univ/labreti/ftp/ftp'
source='interprete.c' object='interprete.o' libtool=no \
depfile='.deps/interprete.Po' tmpdepfile='.deps/interprete.TPo' \
depmode=gcc3 /bin/sh ../admin/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -O2 -O0 -g3 -Wall -c `test -f interprete.c || echo './'`interprete.c
interprete.c: In function `interpreter':
interprete.c:22: warning: implicit declaration of function `printf'
interprete.c:24:2: warning: no newline at end of file
source='connessioni.c' object='connessioni.o' libtool=no \
depfile='.deps/connessioni.Po' tmpdepfile='.deps/connessioni.TPo' \
depmode=gcc3 /bin/sh ../admin/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -O2 -O0 -g3 -Wall -c `test -f connessioni.c || echo './'`connessioni.c
In file included from connessioni.c:21:
connessioni.h:22: warning: parameter names (without types) in function declaration
connessioni.h:25: warning: parameter names (without types) in function declaration
In file included from connessioni.c:21:
connessioni.h:26:47: warning: no newline at end of file
connessioni.c:23: parse error before "srv_address"
connessioni.c: In function `control_connection':
connessioni.c:27: storage size of `destaddr' isn't known
connessioni.c:29: warning: implicit declaration of function `socket'
______________________________________________________________________
connessioni.c:29: `AF_INET' undeclared (first use in this function)
----------------------------------------------------------------------
connessioni.c:29: (Each undeclared identifier is reported only once
connessioni.c:29: for each function it appears in.)
connessioni.c:29: `SOCK_STREAM' undeclared (first use in this function)
connessioni.c:29: invalid lvalue in assignment
connessioni.c:32: warning: implicit declaration of function `printf'
connessioni.c:33: warning: implicit declaration of function `exit'
connessioni.c:46: `FTP_PORT' undeclared (first use in this function)
connessioni.c:47: `srv_address' undeclared (first use in this function)
connessioni.c:48: warning: implicit declaration of function `bzero'
connessioni.c:50: warning: implicit declaration of function `connect'
connessioni.c:50: sizeof applied to an incomplete type
connessioni.c:50: invalid lvalue in assignment
connessioni.c:51: parse error before '{' token
connessioni.c:53: warning: implicit declaration of function `close'
connessioni.c:27: warning: unused variable `destaddr'
connessioni.c: At top level:
connessioni.c:56: parse error before "return"
connessioni.c:60: parse error before "srv_address"
connessioni.c:88:1: warning: no newline at end of file
gmake[2]: *** [connessioni.o] Error 1
gmake[2]: Leaving directory `/mnt/home/univ/labreti/ftp/ftp'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/mnt/home/univ/labreti/ftp'
gmake: *** [all] Error 2
*** errori/e ***
Da quello evidenziato ho subito pensato che probabilmente avevo dimenticato qualche inclusione, ma controllando 
ho visto che era tutto a posto...
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
(queste sono le mie inclusioni)
A questo punto ho aggiunto due librerie aggiuntive nelle opzioni per il linker: -lsocket -lnsl.
Compilando ottengo il risultato postato sopra...
Proprio non capisco, quindi chiedo a voi, e dato che ci siamo, se qualcuno mi spiegasse la differenza
tra compila, make e ricostruisci (i 3 bottoni nella barra) mi farebbe un gran favore.
tnx di tutto
Gabo

rettifico:
compilando il mio programmino che usa i socket in questione con gcc, con la seguente riga
di comando:
gcc connessioni.c interprete.c main.c -o prova_ftp -lsocket -lnsl
ottengo i seguenti errori:
In file included from connessioni.c:21:
connessioni.h:22: warning: parameter names (without types) in function declaration
connessioni.h:25: warning: parameter names (without types) in function declaration
In file included from connessioni.c:21:
connessioni.h:26:47: warning: no newline at end of file
connessioni.c:23: parse error before "srv_address"
connessioni.c: In function `control_connection':
connessioni.c:27: storage size of `destaddr' isn't known
connessioni.c:29: `AF_INET' undeclared (first use in this function)
connessioni.c:29: (Each undeclared identifier is reported only once
connessioni.c:29: for each function it appears in.)
connessioni.c:29: `SOCK_STREAM' undeclared (first use in this function)
connessioni.c:29: invalid lvalue in assignment
connessioni.c:46: `FTP_PORT' undeclared (first use in this function)
connessioni.c:47: `srv_address' undeclared (first use in this function)
connessioni.c:50: sizeof applied to an incomplete type
connessioni.c:50: invalid lvalue in assignment
connessioni.c:51: parse error before '{' token
connessioni.c: At top level:
connessioni.c:56: parse error before "return"
connessioni.c:60: parse error before "srv_address"
connessioni.c:88:1: warning: no newline at end of file
interprete.c:24:2: warning: no newline at end of file
In file included from main.c:23:
connessioni.h:22: warning: parameter names (without types) in function declaration
connessioni.h:25: warning: parameter names (without types) in function declaration
In file included from main.c:23:
connessioni.h:26:47: warning: no newline at end of file
main.c: In function `main':
main.c:29: `EXIT_SUCCESS' undeclared (first use in this function)
main.c:29: (Each undeclared identifier is reported only once
main.c:29: for each function it appears in.)
Il compilatore non mi riconosce i vari AF_INET e compagnia bella, anche se
ho incluso tutto cio' che dicono le man pages...
Bo??? io davo la colpa a kdevelop, ma forse ho sbagliato io! Vi posto
anche le inclusioni che ho fatto:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
che mi dite??
tnx
gabo