Thread: Help

  1. #1
    Registered User
    Join Date
    Nov 2007
    Location
    Vacaville
    Posts
    1

    Help

    My friend wrote a program in CodeWarrior and I'm trying to get it to work in Dev-C++. I keep getting linker errors and I don't know how to fix the problem. Can anyone help me out?

    Code:
    #include <iostream>
    #include <dice.h>
    
    void wait(double);
    
    using namespace std;
    
    int main(void)
    {
    	int xAxis,yAxis,repeat=0;
    	class Dice die(79),die2(25),mover(4);
    	
    	xAxis = die.Roll();
    	yAxis = die2.Roll();
    	for(int temp=0;temp<=yAxis;temp++)
    	{
    		cout<<endl;
    	}
    	
    	for(int temp=0;temp<=xAxis;temp++)
    	{
    		cout<<" ";
    	}	
    	while(repeat==0)
    	{
    		wait (0.05);
    		int numMover=mover.Roll();
    		if((numMover==1)&&(yAxis!=0))
    		{
    			yAxis=yAxis-1;
    			system("cls");
    			for(int temp=0;temp<=yAxis;temp++){cout<<endl;}	
    			for(int temp=0;temp<=xAxis;temp++){cout<<" ";}
    			cout<<"*"<<endl;
    		}
    		if((numMover==2)&&(yAxis!=25))
    		{
    			yAxis=yAxis+1;
    			system("cls");
    			for(int temp=0;temp<=yAxis;temp++){cout<<endl;}	
    			for(int temp=0;temp<=xAxis;temp++){cout<<" ";}
    			cout<<"*"<<endl;
    		}
    		
    		if((numMover==3)&&(xAxis!=0))
    		{
    			xAxis=xAxis-1;
    			system("cls");
    			for(int temp=0;temp<=yAxis;temp++){cout<<endl;}	
    			for(int temp=0;temp<=xAxis;temp++){cout<<" ";}
    			cout<<"*"<<endl;
    		}
    		if((numMover==4)&&(yAxis!=79))
    		{
    			xAxis=xAxis+1;
    			system("cls");
    			for(int temp=0;temp<=yAxis;temp++){cout<<endl;}	
    			for(int temp=0;temp<=xAxis;temp++){cout<<" ";}
    			cout<<"*"<<endl;
    		}
    		
    	}
    	
    	return 0;
    }
    
    void wait (double seconds)
    {
      clock_t endwait;
      endwait = clock () + seconds * CLOCKS_PER_SEC ;
      while (clock() < endwait) {}
    }

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What linker error?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Did you create a project? Did you add dice.cpp to the project?

Popular pages Recent additions subscribe to a feed