Thread: unresolved external...

  1. #1
    Registered User matheo917's Avatar
    Join Date
    Sep 2001
    Posts
    279

    unresolved external...

    hi... i wrote a relatively large program and everything compiles fine, however the linker give me such error...

    --------------------Configuration: Assignment4 - Win32 Debug--------------------
    Linking...
    Assignment4.obj : error LNK2001: unresolved external symbol "void __cdecl calc_positive_average(double &,int &,int &)" (?calc_positive_average@@YAXAANAAH1@Z)
    Debug/Assignment4.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    Assignment4.exe - 2 error(s), 0 warning(s)


    ..............

    if someone could look at this and explain it to me...perhaps you can give me a solution, i included below the function declaration and its definition (where the problem occurs)

    Code:
    (DECLARATION)
    
    void calc_positive_average(double& positive_average,
    						   int& positive_sum,
    						   int& positive_counter);
    Code:
    (DEFINITION)
    
    // calc_postive_average() designed for calculating the average of positive
    //						  integers.
    //
    // Parameters:   address of positive_average, postive_sum and positive_counter
    // Return Value: void
    
    void calc_postive_average(double& positive_average, 
    						  int& positive_sum,
    						  int& positive_counter)
    {
    	
    	static_cast<double>(positive_counter); // casting to "double" so we'll get
    										  // double as a result of division.
    	
    	positive_average = (positive_sum / positive_counter);
    
    }


    thanks in advance
    matheo917

  2. #2
    Registered User WebSnozz's Avatar
    Join Date
    Oct 2001
    Posts
    102
    in the implementation the function name is spelled wrong..


    void calc_positive_average(double& positive_average,
    int& positive_sum,
    int& positive_counter)
    {

    static_cast<double>(positive_counter); // casting to "double" so we'll get
    // double as a result of division.

    positive_average = (positive_sum / positive_counter);

    }

  3. #3
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    >> in the implementation the function name is spelled wrong

    tsk tsk ...

  4. #4
    Registered User matheo917's Avatar
    Join Date
    Sep 2001
    Posts
    279
    thanx....

    hmmm... i wonder how come the compiler didn't find the syntax error in this case, it wound some other once ...

    thanx...

    it works now

    thanx

  5. #5
    Registered User WebSnozz's Avatar
    Join Date
    Oct 2001
    Posts
    102
    I hate that error. I've had it so much though I'm pretty good at figuring it out.

    Sometimes if you include a file and the last line of the file doesn't have a semicolon or something of the sort then you don't get an error in that file, but get an error in whatefver files you include it in, which can be really hard to uncvoer.

    But most of the time if the prototype and implementation don't match you get that error alot.
    WebSnozz-
    Cats have no butt cheeks.
    If one farted, then it would make a flute noise.

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, 03:07 AM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  4. debug to release modes
    By DavidP in forum Game Programming
    Replies: 5
    Last Post: 03-20-2003, 03:01 PM
  5. Unresolved external symbols in OGL
    By Shadow12345 in forum Game Programming
    Replies: 4
    Last Post: 08-04-2002, 09:46 PM