🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #685

Problemas con C

#685
From: |||RIP|||
Date: Mon, 23 Oct 2006 18:09
62 lines
2793 bytes
El codigo de abajo me compila pero no me deja construir el ejecutable, 
en cambio en windows si me deja, �por que?, �como lo soluciono?

El error que me da es que en las lineas 23 y 24 no esta definida la 
referencia a sqrt

23.    solucion1 = ECUACION_POSITIVA(a1,b1,c1);
24.    solucion2 = ECUACION_NEGATIVA(a1,b1,c1);

Os pego el codigo y perdonad por el tocho!!!

Graciasss!!!
========================================================================
/* Created by Anjuta version 1.2.4a */
/*	This file will not be overwritten */

#include <stdio.h>
#include <math.h>

#define PI 3.141591

// Hago dos funciones, una para valores + y otra para los -
// La raiz del polinomio de 2� grado seria esto: sqrt((b*b)-(4*a*c))
#define ECUACION_POSITIVA(a, b, c) ((-b + sqrt((b*b)-(4*a*c))) / (2*a))
#define ECUACION_NEGATIVA(a, b, c) ((-b - sqrt((b*b)-(4*a*c))) / (2*a))
#define VOLUMEN_CILINDRO(r, h) (PI*r*r*h)


int main()
{
	double a1, b1, c1, solucion1, solucion2;
	
	printf ("Introduce los coeficientes (a, b, c): ");
	scanf ("%lf, %lf, %lf", &a1, &b1, &c1);

     solucion1 = ECUACION_POSITIVA(a1,b1,c1);
     solucion2 = ECUACION_NEGATIVA(a1,b1,c1);

	if (a1 != 0) {
		
         printf ("\nSolucion 1: %.2lf", solucion1);
		printf ("; Solucion 2: %.2lf\n", solucion2);
		
		if (solucion1 > solucion2) {
		   printf ("\nRadio: %.2lf",solucion1);
		   printf ("; Altura: %.2lf",solucion2);
  	       printf (", Volumen = %.2lf", VOLUMEN_CILINDRO(solucion1, 
solucion2));
          } else {
		   printf ("\nRadio: %.2lf",solucion2);
		   printf (" Altura: %.2lf",solucion1);
		   printf (" Volumen = %.2lf", VOLUMEN_CILINDRO(solucion2, solucion1));
          }
		
		return (0);

	} else {

		printf ("El parametro a no puede ser 0");	
		return (-1);
	}	
}
Technical Details
Message-ID: <Qw7%g.26150$MA3.24865@news.ono.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!130.59.10.21.MISMATCH!kanaga.switch.ch!switch.ch!newsserver.news.garr.it!news.rediris.es!news.espanix.net!62.42.230.143.MISMATCH!newsf01.ono.com!news.ono.com.POSTED!53ab2750!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f86c8,5fdc58a9abc066ad,start
X-Google-Attributes: gidf86c8,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!130.59.10.21.MISMATCH!kanaga.switch.ch!switch.ch!newsserver.news.garr.it!news.rediris.es!news.espanix.net!62.42.230.143.MISMATCH!newsf01.ono.com!news.ono.com.POSTED!53ab2750!not-for-mail
From: |||RIP||| <ripland@gmail.com>
User-Agent: Thunderbird 1.5.0.7 (X11/20060913)
MIME-Version: 1.0
Newsgroups: es.comp.os.linux.programacion
Subject: Problemas con C
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 62
Message-ID: <Qw7%g.26150$MA3.24865@news.ono.com>
Date: Mon, 23 Oct 2006 20:09:20 +0200
NNTP-Posting-Host: 81.172.59.15
X-Trace: news.ono.com 1161626800 81.172.59.15 (Mon, 23 Oct 2006 20:06:40 MEST)
NNTP-Posting-Date: Mon, 23 Oct 2006 20:06:40 MEST