Linking error?

This is a discussion on Linking error? within the C++ Programming forums, part of the General Programming Boards category; Hi, I download the source code for the slotmachine from this site..but I get this error when I'm compiling.. LIBCD.lib(wincrt0.obj) ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    51

    Linking error?

    Hi,

    I download the source code for the slotmachine from this site..but I get this error when I'm compiling..

    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/SlotMachine.exe : fatal error LNK1120: 1 unresolved externals

    Here's the source code,
    [code]
    /* Slot Machine Program by Joe Tchamitchian*/


    #include <iostream.h>
    #include <stdlib.h>
    #include <time.h>

    int main()

    {


    int x,a, b, c, token=4;

    srand(time(0));

    cout<<"\t***************************************** ***************\n"
    <<"\t* Welcome to slot machine. *\n"
    <<"\t* Would you like to play? (1 to play, 2 not to play) *\n"
    <<"\t********************************************* ***********\n\n";
    cin>>x;

    while(token!=0)

    {cout<<"You have "<<token<< " tokens\n\n"
    <<"Pull? (1 to pull, 2 not to pull)\n\n";
    cin>>x;




    if(x==1)
    {

    a = 1+rand() %10;
    b = 1+rand() %10;
    c = 1+rand() %10;


    cout<<"\t\t"<<a<<" "<<b<<" "<<c<<"\n\n";

    }
    else

    cout<<"OK\n";

    {

    if(a==b==c)

    {

    token+=4;
    cout<<"You win\n\n";
    }
    if(a==b || b==c || a==c)
    {
    token+=1;

    cout<<"You got two out of three\n\n";


    }
    else
    {
    token-=1;


    cout<<"You loose\n\n";
    }

    }
    }



    return 0;
    }
    [/code}

    I hope I got the tag right
    Which is the master, which is the student?

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    51
    Hmm...let me try again

    Hi,

    I download the source code for the slotmachine from this site..but I get this error when I'm compiling..

    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/SlotMachine.exe : fatal error LNK1120: 1 unresolved externals

    Here's the source code,
    Code:
    /* Slot Machine Program by Joe Tchamitchian*/ 
    
    
    #include <iostream.h>
    #include <stdlib.h>
    #include <time.h>
    
    int main()
    
    {
    
    	
    	int x,a, b, c, token=4;
    
    	srand(time(0));
    	
    	cout<<"\t********************************************************\n"
    	    <<"\t*              Welcome to slot machine.                *\n"
    		<<"\t*  Would you like to play? (1 to play, 2 not to play)  *\n"
    		<<"\t********************************************************\n\n";
    	cin>>x;
    
    	while(token!=0)
    
    	{cout<<"You have "<<token<< " tokens\n\n"
    	    <<"Pull? (1 to pull, 2 not to pull)\n\n";
    	cin>>x;
    	
    	
    	
    	
    	if(x==1)
    {	
    	
    	 a = 1+rand() %10;
    	 b = 1+rand() %10;
    	 c = 1+rand() %10;
    	
    	
    	cout<<"\t\t"<<a<<"          "<<b<<"          "<<c<<"\n\n";
    	
    }
    		else
    
    		cout<<"OK\n";
    
    		{		
    				
    		if(a==b==c)
    
    		{
    			
    			token+=4;
    			cout<<"You win\n\n";
    		}		
    		if(a==b || b==c || a==c)
    		{
    			token+=1;
    		
    		cout<<"You got two out of three\n\n";
    		
    		
    		}
    		else
    		{
    			token-=1;
    			
    		
    		cout<<"You loose\n\n";
    		}
    		
    		}
    	}
    		
    		
    				
    			return 0;
    }
    I hope I got the tag right
    Which is the master, which is the student?

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    >Debug/SlotMachine.exe : fatal error LNK1120: 1 unresolved externals
    You're trying to compile a console application in a Win32 project. Open a new project as a console application and it will work.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  3. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 03:49 AM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 12:10 AM

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