Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

calc_values.o: In function `calculate_values\': calc_values.c:(.text+0x3f): unde

ID: 3649759 • Letter: C

Question

calc_values.o: In function `calculate_values':
calc_values.c:(.text+0x3f): undefined reference to `calc_install'
calc_values.c:(.text+0x59): undefined reference to `calc_subtotal'
calc_values.c:(.text+0x71): undefined reference to `calc_price'
main.o: In function `main':
main.c:(.text+0x82): undefined reference to `calc_values'
print_values.o: In function `print_values':
print_values.c:(.text+0x4f): undefined refe
rence to `print_measure'
collect2: ld returned 1 exit status

This is the error message. Someone suggested i post the code, but im warning you its very long and broken up into seperate functions and sub functions.


read_data.c


/* This function will read the data entered by the carpet company
employee.
Written by: Timothy Blazosky
Date: September 16, 2012
Class: Cop2220
*/

#include "my.h"

//Function Delarations
void read_data(int* length, int* width, int* cdiscount, double* costper)

{

printf(" Length of the room (feet)?: ");
scanf("%d", length);

printf(" Width of the room (feet)?: ");
scanf("%d", width);

printf(" Customer discount price (percent)?: ");
scanf("%d", cdiscount);

printf(" Cost per square foot (xxx.xx)?: ");
scanf("%f", costper);

return;

} //read_data


Calc_install.c

/* This function is designed to calculate the installation price of the
carpet.
Written by: Timothy Blazosky
Date: 9/16/2012
*/

#include "my.h"

void calculate_installation(int length, int width, int cdiscount,
double costper, int* area, double* carpet,
double*labor, double*installprice)

{
int value1;
value1 = length * width;
*area = value1;



double value2;
value2 = costper * value1;
*carpet = value2;

double value3;
value3 = LABOR_COST * value1;
*labor = value3;

double value4;
value4 = value2 * value3;
*installprice = value4;

calculate_installation(value1, value2, value3, value4);

return;

} // calc_insallprice

calc_subtotal.c


/* This function is designed to calculate the discount and the subtotal.
Written by: Timothy Blazosky
Date: 09/17/2012
Class: Cop 2220
*/

#include "my.h"

void calculate_subtotal(double* discountcharge, double* subtotal,
double carpet, double labor, double taxcharge, int cdiscount)


{
int value5;
cdiscount = value5;


double value6;
value6 = carpet + labor * value5 / PERCENT;
*discountcharge = value6;

double value7;
value7 = carpet + labor - value6;
*subtotal = value7;

return;

} // calculate subtotal



Calc_price.c

/* This function is designed to calculate the price of the carpet
installation for the customer's bill.
Written by: Timothy Blazosky
Date: 09/17/2012
Class: Cop 2220
*/
#include "my.h"

void calculate_price(double* taxcharge, double* total, double subtotal)

{

double value8;
value8 = subtotal * TAX_RATE;
*taxcharge = value8;

double value9;
value9 = subtotal + value8;
*total = value9;

return;



calc_values.cv

/* This function will pull the information from the three calculation
subfunctions that will calculate the vaules associated with the customers
bill.
Written by: Timothy Blazosky
Date: 09/17/2012
Class: Cop2220
*/

#include "my.h"

void calculate_values(int length, int width, int cdiscount, double
costper, int* area, double* carpet, double* labor, double* installprice,
double* discountcharge, double* subtotal, double* taxcharge, double*
total)

{
calc_install(area, carpet, labor, installprice);
calc_subtotal(cdiscount, discountcharge, subtotal);
calc_price(taxcharge, total);

return;

Preint_measurments.c


/* This function will print the format of the measurement portion of the
bill along with the values.
Written by: Timothy Blazosky
Date: 09/17/2012
Class: Cop 2220
*/

#include "my.h"

void print_measurments(int length, int width, int area)

{
printf(" MEASUREMENT/n" );
printf(" Length%d feet", length );
printf(" Width %d feet", width );
printf(" Area %d square feet",area);

return;

} // print measurements


calc_charges.c


/* This fuction is designed to print the layout and the values of the
customer's bill.
Written by: Timothy Blazosky
Date: 09/17/2012
Class: Cop 2220
*/

#include "my.h"

void print_charges(double carpet, double labor, double installprice,
double discountcharge, double taxcharge, double total,
double costper, int cdiscount, double subtotal)

{

printf(" Charges " );
printf(" DESCRIPTION COST/SQ.FT. CHARGE" );
printf(" ----------- ---------- ------------" );
printf(" Carpet %4.2f %4.2f\$",costper, carpet);
printf(" Labor %4.2f %4.2f",LABOR_COST, labor);
printf(" ------------");
printf(" INSTALLED PRICE %4.2f ",installprice);
printf(" Discount %4.2f %4.2f", cdiscount, discountcharge);
printf(" ------------");
printf(" SUBTOTAL %4.2f", subtotal);
printf(" Tax %4.2f ",taxcharge);
printf(" Total %4.2f ", total);

return;

} // print_charges

print_vaules.c



/* This function is designed to pull the information from two print
subfunctions.
Written By: Timothy Blazosky
Date: 09/17/2012
Class: Cop 2220
*/
#include "my.h"

void print_values(int length, int width, int area, double carpet, double
costper, double labor, double installprice, double discountcharge,
double subtotal, double taxcharge, double total, int cdiscount)

{

print_measure(length, width, area);
print_charges(carpet, costper, labor, installprice, cdiscount,
discountcharge, subtotal, taxcharge, total);

return;

main.c

/* This program plugs in informations to seperate functions and
subfunctions to calculate a customers bill for a arpet company.
Written by: Timothy Blazosky
Date: 09/17/2012
Class: Cop 2220
*/

#include "my.h"

int main (void)

{
//Local declarations


int length;
int width;
int area;
int cdiscount;
double costper;
double carpet;
double labor;
double installprice;
double discountcharge;
double subtotal;
double taxcharge;
double total;


read_data(&length, &width, &cdiscount, &costper);

calc_values(length, width, &area, &costper, &cdiscount, &carpet, &labor, &installprice, &discountcharge, &subtotal, &taxcharge, &total);

print_values(length, width, area, carpet, costper, labor, installprice,
cdiscount, discountcharge, subtotal, taxcharge, total);

return 0;

} // Main

If you gys can see anything that may be causing this problem i would love the help.

Explanation / Answer

The compiler found a symbol that it wasn't expecting or that it thinks is missing. For example, an extra parentheses in any complex block of code, a semicolon placed inappropriately, a semicolon omitted from the previous line, etc. The error is not always on the line mentioned by gcc, but may be on some previous line.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote