Sie sind nicht angemeldet.

1

05.07.2007, 06:56

C Problem

Hallo, kriege beim kompilieren immer so blöde Fehler:
-------------------------
hugo' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k
gmake all-recursive
Making all in src
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -MT hugo.o -MD -MP -MF ".deps/hugo.Tpo" -c -o hugo.o hugo.c; then mv -f ".deps/hugo.Tpo" ".deps/hugo.Po"; else rm -f ".deps/hugo.Tpo"; exit 1; fi
hugo.c:41:2: warning: no newline at end of file
gcc -g -O2 -o hugo hugo.o
hugo.o: In function `main':
/exthdd/development/dev_center/hugo_4_britzki/hugo/src/hugo.c:30: undefined reference to `exp'
/exthdd/development/dev_center/hugo_4_britzki/hugo/src/hugo.c:30: undefined reference to `sin'
/exthdd/development/dev_center/hugo_4_britzki/hugo/src/hugo.c:34: undefined reference to `sqrt'
collect2: ld returned 1 exit status
gmake[2]: *** [hugo] Fehler 1
gmake[2]: Das Target »all« wurde wegen Fehlern nicht aktualisiert.
gmake[1]: *** [all-recursive] Fehler 1
gmake: *** [all] Fehler 2
*** Beendet mit Status: 2 ***
---------------------------
Keinen Plan woran das liegt!

Hier mein Quelltext

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

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

int main(int argc, char *argv[])
{
	float vart; //Zeit
	float varR; //Widerstand 1000
	float varC; //Kapazität
	float varL; //Induktivität
	float varUa; //Ausgangsspannung
	float radikant; //Radikant
	printf("Zeit eingeben!\n");
	scanf("%f",&vart);
	fflush(stdin);
	printf("Widerstand eingeben!\n");
	scanf("%f",&varR);
	fflush(stdin);
	printf("Kapazität eingeben!\n");
	scanf("%f",&varC);
	fflush(stdin);
	printf("Induktivität eingeben!\n");
	scanf("%f",&varL);
	fflush(stdin);
	//radikant=pow(1/(2*varR*varC),2)-1/varL*varC;
	radikant=0.03162673019*exp(-1*vart/0.002)*sin(vart*31618.82351);
	printf("%f\n",radikant);
	
	if(radikant>0)
		varUa=1/sqrt(varC);
	else if(radikant<0)
		exit;
	else
	printf("%f\n",pow(varC,2));

  return EXIT_SUCCESS;
}


Ich hoffe Ihr könnt mir helfen!
Danek im Voraus!

2

05.07.2007, 08:51

RE: C Problem

Sorry,
War wohl etwas unausgeschlafen:
hab erstmal den Quelltext aufs nötigste reduziert:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

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

int main(int argc, char *argv[])
{
	float vart; //Zeit
	float varUa; //Ausgangsspannung
	printf("Zeit eingeben!\n");
	scanf("%f",&vart);
	fflush(stdin);
	varUa=0.03162673019*exp(-1*vart/0.002)*sin(vart*31618.82351);
	printf("%f\n",varUa);

  return EXIT_SUCCESS;
}

strcat

Unix Gladiator

  • »strcat« ist männlich

Beiträge: 2 331

Wohnort: /Earth/Germany/Bavaria/Regensburg

  • Nachricht senden

3

05.07.2007, 09:20

Ich wuerd es halt gegen libm linken wenn Du es schon nutzt. gcc -lm ..
Christian 'strcat' Schneider <http://www.strcat.de/>
/* When all else fails, read the instructions. */

4

05.07.2007, 09:28

k, danke,
wieso macht das mein kdevelop nicht automatisch?

Gruß

strcat

Unix Gladiator

  • »strcat« ist männlich

Beiträge: 2 331

Wohnort: /Earth/Germany/Bavaria/Regensburg

  • Nachricht senden

5

05.07.2007, 09:36

Weil kdevelop macht was Du sagst, nicht das was Du willst.
Christian 'strcat' Schneider <http://www.strcat.de/>
/* When all else fails, read the instructions. */

Thema bewerten