Compilation GCC : undefined reference to ...

Fermé
jchampen Messages postés 2 Date d'inscription samedi 7 février 2009 Statut Membre Dernière intervention 7 février 2009 - 7 févr. 2009 à 20:16
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 - 7 févr. 2009 à 20:34
Bonjour,

Je vous solicite concernant un problème que je rencontre depuis maintenant 3 semaines.

Je souhaite compiler pluiseurs fichiers à l'aide de gcc, mais lorsque que j'execute la commande make, je tombe sur quelques erreur qui empêche la compilation.

Voici mes erreurs :

make[1]: entrant dans le répertoire « /home/johann/Interferometry/nsbas_tmp/src/dinsar »
gcc -g  -O3 -I../../include -c gen_phase.c
gen_phase.c: In function ‘main’:
gen_phase.c:284: attention : ignoring return value of ‘fread’, declared with attribute warn_unused_result
gen_phase.c:286: attention : ignoring return value of ‘fread’, declared with attribute warn_unused_result
gen_phase.c:303: attention : ignoring return value of ‘fread’, declared with attribute warn_unused_result
gen_phase.c:306: attention : ignoring return value of ‘fread’, declared with attribute warn_unused_result
gen_phase.c:401: attention : ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
gen_phase.c:402: attention : ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
gen_phase.c:405: attention : ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
gen_phase.c:406: attention : ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
gen_phase.c:410: attention : ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
gen_phase.c:411: attention : ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
gen_phase.c:414: attention : ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
gen_phase.c:415: attention : ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
gen_phase.c:423: attention : ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
gcc -O3 gen_phase.o -o ../../bin/gen_phase -L../../lib -L/usr/lib/gcc/i486-linux-gnu -lnr -llapack -lblas -lF77 -lI77 -lfftw3 -lgfortran -lm
gcc -g  -O3 -I../../include -c select_interferogram_pair.c
select_interferogram_pair.c: In function ‘main’:
select_interferogram_pair.c:241: attention : format ‘%s’ expects type ‘char *’, but argument 3 has type ‘char (*)[512]’
select_interferogram_pair.c:241: attention : format ‘%f’ expects type ‘float *’, but argument 4 has type ‘float **’
select_interferogram_pair.c:241: attention : format ‘%f’ expects type ‘float *’, but argument 5 has type ‘float **’
select_interferogram_pair.c:252: attention : format ‘%s’ expects type ‘char *’, but argument 3 has type ‘char (*)[512]’
select_interferogram_pair.c:252: attention : ignoring return value of ‘fscanf’, declared with attribute warn_unused_result
gcc -O3 select_interferogram_pair.o -o ../../bin/select_interferogram_pair -L../../lib -L/usr/lib/gcc/i486-linux-gnu -lnr -llapack -lblas -lF77 -lI77 -lfftw3 -lgfortran -lm
gfortran -O -fcray-pointer -std=gnu -ffixed-line-length-none -ffree-line-length-none -fno-underscoring -I../../include -c slave_coregistration.F
gcc -g  -O3 -I../../include -c second.c
second.c: In function ‘secondo’:
second.c:97: attention : incompatible implicit declaration of built-in function ‘printf’
second.c: In function ‘secondo_’:
second.c:120: attention : incompatible implicit declaration of built-in function ‘printf’
gfortran slave_coregistration.o -o  ../../bin/slave_coregistration second.o -L/home/johann/Interferometry/ROI_PAC_3_0/ROI_PAC/LIB/src -lroipac  #-L../../lib -L/usr/lib/gcc/i486-linux-gnu -lnr -llapack -lblas -lF77 -lI77 -lfftw3 -lgfortran -lm
slave_coregistration.o: In function `MAIN__':
slave_coregistration.F:(.text+0x838): undefined reference to `rdf_init'
slave_coregistration.F:(.text+0x84c): undefined reference to `rdf_init'
slave_coregistration.F:(.text+0x860): undefined reference to `rdf_init'
slave_coregistration.F:(.text+0x874): undefined reference to `rdf_init'
slave_coregistration.F:(.text+0x8ee): undefined reference to `rdf_read'
slave_coregistration.F:(.text+0x91e): undefined reference to `rdfval'
slave_coregistration.F:(.text+0x9e8): undefined reference to `rdfval'
slave_coregistration.F:(.text+0xa95): undefined reference to `rdfval'
slave_coregistration.F:(.text+0xb59): undefined reference to `rdfval'
slave_coregistration.F:(.text+0xc86): undefined reference to `rdfval'
slave_coregistration.o:slave_coregistration.F:(.text+0xd50): more undefined references to `rdfval' follow
slave_coregistration.o: In function `MAIN__':
slave_coregistration.F:(.text+0x1f25): undefined reference to `rdflen'
slave_coregistration.F:(.text+0x3712): undefined reference to `doppler'
collect2: ld a retourné 1 code d'état d'exécution
make[1]: *** [slave_coregistration] Erreur 1



Petite précision, je suis un novice sous linux

Merci d'avance

6 réponses

sof26110 Messages postés 1032 Date d'inscription samedi 31 janvier 2009 Statut Membre Dernière intervention 11 octobre 2010 115
7 févr. 2009 à 20:18
Tu as écrit comme sa ton code ?
il faut l'espacer.
mettre des commentaires avec la fonction \\.
etc etc.
0
jchampen Messages postés 2 Date d'inscription samedi 7 février 2009 Statut Membre Dernière intervention 7 février 2009
7 févr. 2009 à 20:22
Tout d'abord merci pour ta rapidité,

Je ne comprend pas bien ta réponse, le message posté ne contient pas code, il s'agit des messages affichés dans le terminal lorsque j'execute la commande "make".

En espérant avoir répondu à ta réponse...
0
sof26110 Messages postés 1032 Date d'inscription samedi 31 janvier 2009 Statut Membre Dernière intervention 11 octobre 2010 115
7 févr. 2009 à 20:24
a dacors.
et bien fait parvenir ton code.
c'est du C++ ?
du Java ?
...
0
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
7 févr. 2009 à 20:28
Salut,

Vu l'extension du fichier select_interferogram_pair.c je pense que c'est du C
0
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
7 févr. 2009 à 20:27
Salut,

La compilation t'envoie des erreurs puisqu'il y a beaucoup des erreurs dans ton code.

Tu n'as pas utiliser #include <stdio.h>

Dans le fichier select_interferogram_pair.c

A la ligne 241

: attention : format ‘%s’ expects type ‘char *’, but argument 3 has type ‘char (*)[512]’

Tu utilises %s pour afficher un char * mais tu as un tableau de chaînes de caractères en argument

format ‘%f’ expects type ‘float *’, but argument 4 has type ‘float **’

Tu utilises %f pour afficher un float * mais l'argument a le type float **

Les fonctions rdfval, rdf_init, rdf_read, rdflen se trouvent où?


Bref, ton programme a combien des fichiers?
Peux tu les mettre sur cjoint.com pour voir?

0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
sof26110 Messages postés 1032 Date d'inscription samedi 31 janvier 2009 Statut Membre Dernière intervention 11 octobre 2010 115
7 févr. 2009 à 20:31
mais normalement si tu programme en C il y a automatiquement la bibliothèque <stdio.h> inclut.
c'est bizarre ton logiciel.
moi j'utilisé Dev c++ et je l'aimer bien.
malheureusement maintenant je ne programme plus faute de temps.
0
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
7 févr. 2009 à 20:34
Salut,

il y a automatiquement la bibliothèque <stdio.h> inclut.

Un code C on peut l'écrire avec n'importe quel éditeur de texte sans mise en forme.
Sur Dev C++ effectivement la directive #include <stdio.h> est mis automatique mais pas si on crée le code dans un éditeur comme VI par exemple

moi j'utilisé Dev c++ et je l'aimer bien.
Moi, j'utilise Vim et je l'adore ;-))

0