Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
990 connectés 

  FORUM HardWare.fr
  Programmation
  C

  Probleme conflit de type

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Probleme conflit de type

n°1807831
boy63
etudiant
Posté le 03-11-2008 à 18:38:38  profilanswer
 

Bonsoir,
 
je suis en train de creer un programme pour calculer le volume d'un tétraèdre mais j'ai une erreur de conflit de type lors de la compilation...
Je ne la comprends pas malheuresement...
Pouvez m'aider svp?
 
Voici le programme
 
fichier.h
 
#include <stdio.h>
#include <math.h>
 
typedef double real;
typedef struct { real x,y,z; } Point;
 
void LecturePoints(Point T[],int n);
void AffichePoints(Point T[],int n);
real SurfaceTetraedre(Point A[]);
real SurfaceParallelepipede(Point B[]);
real VolumeTetraedre(Point A1, Point A2, Point A3,Point A4);
real VolumeParallelepipede(Point B[]);
real NormeProdVect(Point A1,Point A2,Point A3);
real ProdMixte(Point A1,Point A2,Point A3,Point A4);
 
fichier.c
 
#include "volume.h"
 
 
/* lecture des coordonnees de n points */
void LecturePoints(Point T[], int n)
{
 int i;
 for (i=0; i<n;i++) {
  printf("coordonnees du point %d =",i+1);
  scanf("%lf %lf %lf",&T[i].x,&T[i].y,&T[i].z);
 }
 return;
}
/* affichage de n points */
void AffichePoints(Point T[],int n)
{
  int i;
  for (i=0; i<n; i++){
    printf("Point %d  x=%lf y=%lf z=%lf\n",i+1,
           T[i].x,T[i].y,T[i].z);
 }
}
/* calcul du produit vectoriel AB.AC*/
real NormeProdVect(Point A1,Point A2,Point A3){
   real x1=A2.x-A1.x;
   real y1=A2.y-A1.y;
   real z1=A2.z-A1.z;
   real x2=A3.x-A1.x;
   real y2=A3.y-A1.y;
   real z2=A3.z-A1.z;
   real X,Y,Z;
 
   X=y1*z2-y2*z1;
   Y=z1*x2-z2*x1;
   Z=x1*y2-x2*y1;
   return sqrt(X*X+Y*Y+Z*Z);
}
 
double ProduitMixte(Point A1,Point A2,Point A3){
/*definition des vecteurs*/
 
 Point T[4];
 A1.x=T[1].x-T[0].x;
 A1.y=T[1].y-T[0].y;
 A1.z=T[1].z-T[0].z;
 A2.x=T[2].x-T[0].x;
 A2.y=T[2].y-T[0].y;
 A2.z=T[2].z-T[0].z;
 A3.x=T[3].x-T[0].x;
 A3.y=T[3].y-T[0].y;
 A3.z=T[3].z-T[0].z;
 
 /*calcul du produit mixte*/
   
 double x,y,z;
 /*produit A1 v A2*/
 x=A1.y*A2.z-A2.y*A1.z;
 y=A1.z*A2.x-A2.z*A1.x;
 z=A1.x*A2.y-A2.x*A1.y;
 
return x*A3.x+y*A3.y+z*A3.z;
}
 
/*volume tétraèdre*/
real VolumeTetraedre(Point A1,Point A2,Point A3,Point A4)
{
Point AB,AC,AD;
return 0.15*ProduitMixte(AB,AC,AD);
}
 
main.c
 
#include "volume.h"
#include <stdio.h>
#include <math.h>
 
int main()
{
   
 Point T[3];Point A1 ;Point A2 ;Point A3 ;
 
 
 /* Saisie et controle des données*/
 printf("Saisie des points" );
 LecturePoints(T,4);
 AffichePoints(T,4);
 
 /*float prodm;
        prodm=ProduitMixte(A1,A2,A3);
 printf("produit mixte=%lf",prodm);*/
         
  calcul du Volume du Tetraedre  
   float volT=VolumeTetraedre(T[0],T[1],T[2],T[3]);
 
 printf("volumeT= %lf\n",volT);
   
}
 
et voici le rapport d'erreur:
 
volume.c:66: erreur: conflicting types for «VolumeTetraedre»
volume.h:11: erreur: previous declaration of «VolumeTetraedre» was here
 ou cette erreur la c'est une fois sur deux...
/usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld a retourné 1 code d'état d'exécution
 
Merci d'avance pour vos réponses.
 

mood
Publicité
Posté le 03-11-2008 à 18:38:38  profilanswer
 

n°1807841
Modération
Posté le 03-11-2008 à 19:03:02  answer
 

Un seul sujet parait suffisant, non?
http://forum.hardware.fr/hfr/Progr [...] 8891_1.htm


Aller à :
  FORUM HardWare.fr
  Programmation
  C

  Probleme conflit de type

 

Sujets relatifs
probleme simple avec un tableauProblème morceau de code
Probleme table-cell dans Mozilla et IE7problème code php (simple, mais difficile pr moi)
Problème avec Lightbox sous FirefoxProblème d'accents après copie d'une base [résolu]
Problème avec IEProblème étrange (inqualifiable)
dfloat / float -- Problème avec NGDprobleme de programmation en C
Plus de sujets relatifs à : Probleme conflit de type


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR