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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started