Question: Hello, I am trying to test this program with gcc -Wall -Im but it is showing me this error /tmp/cctn74rT.o: In function `main': voltage.c:(.text+0x42): undefined

Hello, I am trying to test this program with gcc -Wall -Im but it is showing me this error "/tmp/cctn74rT.o: In function `main': voltage.c:(.text+0x42): undefined reference to `exp' collect2: ld returned 1 exit status"

this is the program

#include

#include

#include

// defining the constants

#define V 10

#define R 3000

#define C 50 * pow(10,-6)

#define tau 0.15

int main()

{

//declaring the data types

float t, vt;

// displaying the header of the table

printf("Time (sec)\t voltage ");

// loop to calculate the voltage vt per the provided equation , 1/15 = 0.0666

for (t=0;t<=1;t=t+0.0666)

{

vt=V*(1 - exp(-t/tau));

// displaying data

printf("%0.02f \t\t%0.02f ",t,vt);

}

return 0;

}

// end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!