link error

This is a discussion on link error within the C++ Programming forums, part of the General Programming Boards category; hi, the program below is a very simple conversion program. the logic is correct and it compiles fine but i ...

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    84

    link error

    hi,

    the program below is a very simple conversion program. the logic is correct and it compiles fine but i get a link error in both win32 (vc++) and linux:
    --------------------Configuration: conv - Win32 Debug--------------------
    Linking...
    conv.obj : error LNK2001: unresolved external symbol "void __cdecl output(double &,double &)" (?output@@YAXAAN0@Z)
    Debug/conv.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    conv.exe - 2 error(s), 0 warning(s)
    --------------------Configuration: conv - Win32 Debug--------------------



    can someone tell me what the error means?

    thanks,
    barneygumble742


    Code:
    -----
    
    #include <iostream>
    #include <cmath>
    using namespace std;
    
    const int INCHES_PER_FOOT = 12;
    const int C_METERS_PER_METER = 100;
    const double METERS_PER_FOOT = 0.3048;
    
    void input(double &feet, double &inches);
    void convert(double &input_one, double &input_two);
    void output(double &meters, double &c_meters);
    
    int main()
    {
    double feet, inches, meters, c_meters;
    
    	input(feet, inches);
    	convert(feet, inches);
    		meters=feet;
    		c_meters=inches;
    	output(meters, c_meters);
    
    return 0;
    }
    
    void input(double &feet, double &inches)
    {
    	cout << "Feet  : ";	cin >> feet;
    	cout << "Inches: ";	cin >> inches;
    }
    
    void convert(double &input_one, double &input_two)
    {
    double feet, inches;
    	feet = input_one;
    	inches = input_two;
    
    	input_one = ( ( inches / INCHES_PER_FOOT ) + feet ) * METERS_PER_FOOT;
    
    	input_one = floor( input_one );
    	input_two = abs ( input_one - input_two ) * 100;
    }
    
    void output(int &meters, int &c_meters)
    {
    	cout << "Meters     : "	<< meters << endl;
    	cout << "Centimeters: "	<< c_meters << endl;
    }

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,806
    because you defined you output as output(int, int) and not output(double,double) like you prototyped.
    Woop?

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    84
    thanks. i feel like a dummy.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  2. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 03:09 AM
  3. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  4. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  5. DX - CreateDevice - D3DERR_INVALIDCALL
    By Tonto in forum Game Programming
    Replies: 3
    Last Post: 12-01-2006, 06:17 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21