Rechercher : dans
Par :

Compilation GCC : undefined reference to ...

Dernière réponse le 7 fév 2009 à 20:34:07 jchampen, le 7 fév 2009 à 20:16:05 
 Signaler ce message aux modérateurs

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
Configuration: Pc portable PackardBell
Intel centrino duo 2 Ghz
Ubuntu 8.10
gcc 4.3.2
Firefox 3.0.5

Meilleures réponses pour « Compilation GCC : undefined reference to ... » dans :
Compiler du C sous Linux/UNIX VoirSous Linux, le compilateur de C est gcc. Il est installé de base sur plusieurs distributions, mais sur Debian (et celles qui en découlent) il faudra l'installer (aptitude install gcc). gcc Syntaxe de GCC gcc Tout d'abord, il faut savoir...
La compilation et les modules en C et en C++ VoirCet article a pour vocation d'introduire les notions de bases de la compilation en C et en C++ et de la programmation modulaire. Il permet de mieux comprendre les messages d'erreur du compilateur. Les notions abordées ici sont indépendantes du...

1

sof26110, le 7 fév 2009 à 20:18:59

Tu as écrit comme sa ton code ?
il faut l'espacer.
mettre des commentaires avec la fonction \\.
etc etc. Parfois il vaut mieux se taire que de dire n'importe quoi.
 

Répondre à sof26110

2

jchampen, le 7 fév 2009 à 20:22:30

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...

Répondre à jchampen

3

sof26110, le 7 fév 2009 à 20:24:38

A dacors.
et bien fait parvenir ton code.
c'est du C++ ?
du Java ?
... Parfois il vaut mieux se taire que de dire n'importe quoi.
 

Répondre à sof26110

5

lami20j, le 7 fév 2009 à 20:28:47

Salut,

Vu l'extension du fichier select_interferogram_pair.c je pense que c'est du C 106485010510997108

Répondre à lami20j

4

lami20j, le 7 fév 2009 à 20:27:32

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?

106485010510997108

Répondre à lami20j

6

sof26110, le 7 fév 2009 à 20:31:13

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. Parfois il vaut mieux se taire que de dire n'importe quoi.
 

Répondre à sof26110

7

 lami20j, le 7 fév 2009 à 20:34:07

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 ;-))

106485010510997108

Répondre à lami20j