unresolved external symbol

This is a discussion on unresolved external symbol within the C++ Programming forums, part of the General Programming Boards category; hi guys, what does this error mean? Code: Linking... hw1017_6.obj : error LNK2001: unresolved external symbol "int __cdecl flipacoin(int,int)" (?flipacoin@@YAHHH@Z) ...

  1. #1
    Registered User scuba22's Avatar
    Join Date
    Oct 2002
    Posts
    35

    unresolved external symbol

    hi guys,
    what does this error mean?


    Code:
    Linking...
    hw1017_6.obj : error LNK2001: unresolved external symbol "int __cdecl flipacoin(int,int)" (?flipacoin@@YAHHH@Z)
    Debug/hw 1017_6.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
    i'm getting it when trying to run my coin toss program.

    Code:
    //Michele DAddio CS210
    //10_17_02
    //HW #6 : RANDOM
    
    
    #include<iostream>
    #include<cstdlib>
    #include<ctime>
    #include<iomanip>
    using namespace std;
    
    
    
    
    
    
    	//function prototype
    
    	int flipacoin (int, int);
    
    	void main()
    	{
    			int h = 0;
    			int t = 0;
    			int freqheads = 0;
    			int freqtails = 0;
    
    			for (int flip = 1; flip <= 10; flip++){
    				cout << flipacoin(h,t) << endl;
    				if(1)
    					cout << "H" << endl;
    				else if(0)
    					cout << "T" << endl;
    			  
    			 
    			  freqheads++;
    			  freqtails++;
    			}
    
    
    
    	}
    
    
    	//function definition
    	int flipacoin()
    	{
    		
    	return (rand () % 2);
    
    	}




    thanks Miche

  2. #2
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    Your flipacoin function isn't taking any parameters, even though the prototype says it should. That's your 'unresolved external symbol'.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  3. #3
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    I've noticed that the unresolved external symbol is always associated with an error in the declaration of a function, Is this true.

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, 01: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. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. debug to release modes
    By DavidP in forum Game Programming
    Replies: 5
    Last Post: 03-20-2003, 03:01 PM

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