Thread: polink error ??

  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    29

    polink error ??

    here's the code
    Code:
    #include<stdio.h>
    
    
    #define basic_cost 5.00
    #define cost_1000_liter 1.10
    #define fine 2.00 
    
    
    float calc_usage_cost(int , int );
    float calc_unpaid_cost(float );
    float calc_total_bill( float, float);
    void print_bill(int ,float);
    
    
    int main()
    {
    	int prev_meter , cur_meter , act_num;
    	float unpaid_bill, usage, unpaid, total, collection=0;
    	char choice;
    
    
    	printf("------------------Perlis Water----------------");
    	printf("this program generates monthly water bill");
    	printf("------------------------------------------------------");
    
    
    	do
    	{
    		printf("Enter account number:");
    		scanf("%d", &act_num);
    		printf("enter unpaid bill :");
    		scanf("%f", &unpaid_bill );
    		printf("Enter previous and current meters :");
    		scanf("%d%d", &prev_meter, &cur_meter);
    		
    		usage = calc_usage_cost(prev_meter , cur_meter);
    		unpaid = calc_unpaid_cost(unpaid_bill);
    		total = calc_total_bill( usage , unpaid );
    		print_bill(act_num, total);
    		collection = collection + total;
    
    
    		printf("Do you wish to continue:");
    		scanf("%c", &choice);
    	} while((choice == 'y' ) || (choice == 'Y'));
    
    
    	printf("Perlis water collection : %.2f", collection);
    
    
    	return 0;
    }
    
    
    float calc_usage_cost(int prev, int cur )
    { 
    		float water_usage, usage_cost;
    		water_usage = cur - prev;
    		usage_cost = (water_usage/1000) * cost_1000_liter;
    		return(usage_cost);
    }
    
    
    float calc_unpaid_cost(float unpaid)
    {
    	float unpaid_cost;
    	
    	if (unpaid >0)
    		unpaid_cost = unpaid + fine;
    	else 
    		unpaid_cost = 0;
    	return(unpaid_cost);
    }
    
    
    float cal_total_bill( float usage_cost, float unpaid_cost)
    {
    	float total_bill;
    	total_bill = basic_cost + usage_cost + unpaid_cost;
    	return(total_bill);
    }
    
    
    void print_bill(int act_num ,float total_bill)
    {
    	printf("\n\nYour account number is %d \n", act_num);
    	printf("Your total bill is RM %5.2f\n", total_bill);
    }
    got this error when execute :
    Building function2.obj.
    Building lab.exe.
    POLINK: error: Unresolved external symbol 'calc_total_bill'.
    POLINK: fatal error: 1 unresolved external(s).
    *** Error code: 1 ***
    Done.

    so what's the problem ?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Spelling

    total = calc_total_bill( usage , unpaid );

    float cal_total_bill( float usage_cost, float unpaid_cost)

    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2012
    Posts
    29
    ok..
    thank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 10-29-2012, 03:33 AM
  2. Replies: 15
    Last Post: 11-28-2011, 11:48 AM
  3. Replies: 4
    Last Post: 07-24-2011, 09:38 PM
  4. Replies: 1
    Last Post: 11-15-2010, 11:14 AM
  5. Replies: 3
    Last Post: 10-02-2007, 09:12 PM