GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 25-Mar-2007, 23:51
calin86 calin86 is offline
New Member
 
Join Date: Mar 2007
Posts: 4
calin86 is on a distinguished road
Question

need help with linker problem


Hi everyone,

i have been trying to do a program that will make a robot move the way i want. But when i try to make an EXE file or link using one of the files, it prompt me linker error message. The software i am using is Turbo C++ ver. 3.01.

This is the code that i have been working on.

CPP / C++ / C Code:
#include <stdio.h>
#include <stdlib.h>
#include <DOS3.h>

#define WORD_CONSTANT 65536
#define DATA            	1
#define COMMAND         	0
#define RSTI            	0x1D
#define RESET           	0x00
#define LFIL            	0x1E
#define UDF             	0x04
#define LTRJ            	0x1F
#define STT             	0x01
#define RDRV			0x0B
#define RDRP			0x0A
#define Traj_Cntrl      	0x002A          
#define Fil_Cntrl       	0x0008  //kp set , ki, kd and il remain untouched
					//ds set to 1 x Ts

#ifndef _clock_t
#define _clock_t
typedef long clock_t;
#endif

int Fir;
int ESC_BASE;
int channel; 				//Indicates which channel is in use, "0" for CHANNEL 1 and "1" for CHANNEL 2
int Filter_Cntrl=0x040F;	//Filter contral mode (enable loading of filter parameter)
int Right_Trajectory_Cntrl;	//Trajectory control mode (enable loading of trajectory parameter)
int Left_Trajectory_Cntrl;	
int Kp=0x120;	//0x380		//0x280	//Filter constant Kp, Ki, Kd, and Il(also known as parameter)
int Ki=0x0020;
int Kd=0x100;						//0x0280;
int Il=0x8000;
int clock_t_timer;
int interval_time;
int calculate_map ( float VRc , float VLc );
int SpotTurnAngleCalculate ( float AnglePosition );
float RA;
float LA;
long int Right_Acceleration; 		//Left and Right vectors, both acceleration and velocity
long int Left_Acceleration;
long int Right_Vel;
long int Left_Vel;
long int Right_Pos;	
long int Left_Pos;	
float Right;				//Indicates the linear speed of robot in cm/s
float Left;
float Right_Acc;					//Indicates the linear acceleration of robot in cm/s/s
float Left_Acc;
float Real_Right;			//store the converted linear speeds
float Real_Left;
float Right_Position;		//store the converted distance traveled
float Left_Position;			
float Right_Velocity = 0.0;
float Left_Velocity = 0.0;
float OldRight_Velocity = 0.0;
float OldLeft_Velocity = 0.0;		
float OldRight_Position = 0.0;
float OldLeft_Position = 0.0;
float Wheel_circumference = 21.8;
int timer;

void _Cdecl delay (unsigned __milliseconds);
#ifdef __cplusplus
extern "C" {
#endif
clock_t _Cdecl clock (void);
#ifdef __cpluscplus
}
#endif

/*********************************************************************************************
*	SET the PS register bit to indicate COMMAND or DATA is being send		
*********************************************************************************************/
void set_PS(int byte)
{
int temp;

        temp=(inp(ESC_BASE+0x02) & 0x0f);           // Store current status register

        if (byte==DATA)
           outp(ESC_BASE+0x02,temp & 0x07);			// Enables data sending
        if (byte==COMMAND)
           outp(ESC_BASE+0x02,temp | 0x08);			// Enables command sending
}

int _check_busy(int channel)
{
	int temp;

	set_PS(COMMAND);
	temp = inp(ESC_BASE+channel);
	return(temp & 0x01);
}

void _wait_busy(int channel)
{
	do
		{}
	while(_check_busy(channel));
}

/*********************************************************************************************
*	Read real position of right side motor													 *
*********************************************************************************************/
float Read_Right_Position(void)
{
	char first;			
	char second;
	char third;
	char fourth;
	int RP;

	channel=0;				//set as channel number 1
	set_PS(COMMAND);
    outp(ESC_BASE+channel,RDRP);		//send command to read real position
    _wait_busy(channel);
        	
    set_PS(DATA);
    first=inp(ESC_BASE+channel);			//store higher word
    second=inp(ESC_BASE+channel);
    _wait_busy(channel);
    
    set_PS(DATA);
    third=inp(ESC_BASE+channel);			//store lower word
    fourth=inp(ESC_BASE+channel);
    _wait_busy(channel);
    
    RP=first;
	RP=((RP<<8)&0xFF00)+second;		//arrange the whole word
	RP=((RP<<8)&0xFFFF00)+third;
	RP=((RP<<8)&0xFFFFFF00)+fourth;
    
	RP=(-1)*RP;						//clarify the direction
	
	Right_Position=RP;				//store as a float value
    Right_Position=(Right_Position)/(2048)/(3.75)*(Wheel_circumference);//convert the reading into distance traveled
    ///printf("\nread right position (RP):%d", RP);
	//printf("\nread right position (Right_Position):%d", Right_Position);
    return Right_Position;
}

/*********************************************************************************************
*	Read real position of left side motor													 *
*********************************************************************************************/
float Read_Left_Position(void)
{
	char first;			
	char second;
	char third;
	char fourth;
	int LP;
	
	channel=1;				//set as channel number 2
	set_PS(COMMAND);
    outp(ESC_BASE+channel,RDRP);		//send command to read real position
    _wait_busy(channel);
        	
    set_PS(DATA);
    first=inp(ESC_BASE+channel);			//store higher word
    second=inp(ESC_BASE+channel);
    _wait_busy(channel);
    
    set_PS(DATA);
    third=inp(ESC_BASE+channel);			//store lower word
    fourth=inp(ESC_BASE+channel);
    _wait_busy(channel);
    
    LP=first;
	LP=((LP<<8)&0xFF00)+second;		//arrange the whole word
	LP=((LP<<8)&0xFFFF00)+third;
	LP=((LP<<8)&0xFFFFFF00)+fourth;
 
    Left_Position=LP;				//store as a float value
    Left_Position=(Left_Position)/(2048)/(3.75)*(Wheel_circumference);//convert the reading into distance traveled
    //printf("\nread left position (LP):%d", LP);
    //printf("\nread left position (Left_Position):%d", Left_Position);
    return Left_Position;
}

/*********************************************************************************************
*	Setting filter constant  																 *
*********************************************************************************************/
void _set_filter(int channel, int Cntrl, int Kp, int Ki, int Kd, int Il)
{      
        set_PS(COMMAND); 
        outp(ESC_BASE+channel,LFIL);
        _wait_busy(channel);

        set_PS(DATA); 
        outp(ESC_BASE+channel,Cntrl>>8 & 0xff);     //Control word HB
        outp(ESC_BASE+channel,Cntrl & 0xff);        //and LB      
        _wait_busy(channel); 


        if (Cntrl & 0x0008)
        {
        set_PS(DATA);
        outp(ESC_BASE+channel,Kp>>8 & 0xff);        
        outp(ESC_BASE+channel,Kp & 0xff);             //Kp loaded 
        _wait_busy(channel); 
        }
        if (Cntrl & 0x0004)
        {
        set_PS(DATA);
        outp(ESC_BASE+channel,Ki>>8 & 0xff);        
        outp(ESC_BASE+channel,Ki & 0xff);             //Ki loaded 
        _wait_busy(channel); 
        }
        if (Cntrl & 0x0002)
        {
        set_PS(DATA);
        outp(ESC_BASE+channel,Kd>>8 & 0xff);        
        outp(ESC_BASE+channel,Kd & 0xff);             //Kd loaded 
        _wait_busy(channel); 
        }
        if (Cntrl & 0x0001)
        {
        set_PS(DATA);
        outp(ESC_BASE+channel,Il>>8 & 0xff);        
        outp(ESC_BASE+channel,Il & 0xff);             //Il loaded 
        _wait_busy(channel); 
        }

        set_PS(COMMAND); 
        outp(ESC_BASE+channel,UDF);
        _wait_busy(channel);
}

/*********************************************************************************************
*	Set trajectory control																	 *
*********************************************************************************************/
void _set_traject(int channel, int Cntrl, long int Acc, long int Vel, long int Pos)
{
        set_PS(COMMAND); 
        outp(ESC_BASE+channel,LTRJ);
        _wait_busy(channel);

        set_PS(DATA); 
        outp(ESC_BASE+channel,Cntrl>>8 & 0xff);             // Send out high byte        
        outp(ESC_BASE+channel,Cntrl & 0xff);                // Send out low byte
        _wait_busy(channel);

        if (Cntrl & 0x20)                               // Acceleration will be loaded
        {
        set_PS(DATA);
        outp(ESC_BASE+channel,(int)(Acc>>24 & 0xff));        
        outp(ESC_BASE+channel,(int)(Acc>>16 & 0xff));       // Acc loaded high word
        _wait_busy(channel);  

        set_PS(DATA);
        outp(ESC_BASE+channel,(int)(Acc>>8 & 0xff));        
        outp(ESC_BASE+channel,(int)(Acc & 0xff));           // Acc loaded low word
        _wait_busy(channel);  
        }

        if (Cntrl & 0x08)                               // Velocity will be loaded
        {
        set_PS(DATA);
        outp(ESC_BASE+channel,(int)(Vel>>24 & 0xff));        
        outp(ESC_BASE+channel,(int)(Vel>>16 & 0xff));       // Vel loaded high word
        _wait_busy(channel);  

        set_PS(DATA);
        outp(ESC_BASE+channel,(int)(Vel>>8 & 0xff));        
        outp(ESC_BASE+channel,(int)(Vel & 0xff));           // Vel loaded low word
        _wait_busy(channel);  
        }

        if (Cntrl & 0x02)                               // Position will be loaded
        {
        set_PS(DATA);
        outp(ESC_BASE+channel,(int)(Pos>>24 & 0xff));        
        outp(ESC_BASE+channel,(int)(Pos>>16 & 0xff));       // Pos loaded high word
        _wait_busy(channel);  

        set_PS(DATA);
        outp(ESC_BASE+channel,(int)(Pos>>8 & 0xff));        
        outp(ESC_BASE+channel,(int)(Pos & 0xff));           // Pos loaded low word
        _wait_busy(channel);  
        }                

        set_PS(COMMAND); 
        outp(ESC_BASE+channel,STT);                         // Start movement
        _wait_busy(channel);   
}

/*********************************************************************************************
*	Initialize the motor	     															 *
*********************************************************************************************/
int _initialize(int channel) 
{

        set_PS(COMMAND);                // Enter command mode

        outp(ESC_BASE+channel,RESET);       // Issue software reset         
        _wait_busy(channel);

        outp(ESC_BASE+channel,RSTI);        // Reset interrupts
        _wait_busy(channel);

        set_PS(DATA);

        outp(ESC_BASE+channel,00);          // HB, don't care
        outp(ESC_BASE+channel,00);          // LB write 00
        _wait_busy(channel);
        return(0);                      // Not really needed
}

/*********************************************************************************************
*	Calculations and coding of velocity and acceleration									 *
**********************************************************************************************
**********************************************************************************************
*	Wheel diameter = 7cm; Wheel circumference = 22cm										 *
*	Gear ratio = 60/16																		 *
*	Wheel's angular velocity(rps) = Linear speed(cm/s)/Circumference  						 *
*	Motor's angular velocity(rps) = Wheel's angular velocity(rps) x Gear ratio				 *
*																							 *
*	V = R x T x desired rps																	 *
*	R = 512 x 4 = 2048																		 *
*	T = 2048/4E6 = 512us																	 *
*	thus V = 1.048576 x desired rps															 *
*																							 *
*	A = R x T x T x desired acceleration(r/s/s)												 *
*	thus A = (5.36870912E-4) x desired acceleration										     *
*********************************************************************************************/
void Vectors_Coding(void)
{
	Right_Vel = (WORD_CONSTANT)*(1.048576)*(3.75)*(Right)/(Wheel_circumference);
	Left_Vel = (WORD_CONSTANT)*(1.048576)*(3.75)*(Left)/(Wheel_circumference);
	Right_Acceleration = (WORD_CONSTANT)*(5.36870912E-4)*Right_Acc;
	Left_Acceleration = (WORD_CONSTANT)*(5.36870912E-4)*Left_Acc;
}

/*********************************************************************************************
*	Clears interrupts and returns status register											 *
*********************************************************************************************/
int _clr_intr(int channel)
{
int temp;

        set_PS(COMMAND); 
        outp(ESC_BASE+channel,RSTI);        // Reset command
        _wait_busy(channel);   
        
        set_PS(DATA);

        outp(ESC_BASE+channel,00);          // HB, don't care
        outp(ESC_BASE+channel,00);          // LB write 00
        _wait_busy(channel);

        set_PS(COMMAND); 
        temp = inp(ESC_BASE+channel);
        _wait_busy(channel);
        return(temp);
}

/*********************************************************************************************
*	To stop the motor from turning, disable the torque										 *
*********************************************************************************************/
void _motor_off(void)
{
int Traj_Cntrl_n;

        Traj_Cntrl_n = ((Traj_Cntrl | 0x0100) & 0xFF00);
        // Set Motor-OFF bit and set no other parameters to be loaded
        
		for(channel=0;channel<2;channel++)
		{
        	_set_traject(channel,Traj_Cntrl_n,0L,0L,0L); 
        	_clr_intr(channel);     // Previous trajectory interrupt status cleared;
         	                        // must be performed before new trajectory works
        }
        delay(10);
}       

/*********************************************************************************************
*	Set the position of the motor							 								 *
*********************************************************************************************/

void SetPosition(float RP, float LP, float RV, float LV, float AnglePosition)
{		
 	_motor_off();		//Motor must be stopped before loading new acceleration(manually stopped)
						//also for the position control purpose
	RP=(-1)*RP;
	Right_Pos= (2048)*(3.75)*(RP)/Wheel_circumference;
	Left_Pos= (2048)*(3.75)*(LP)/Wheel_circumference;
	
	//printf("\nset position (RP):%d", Right_Pos);
	//printf("\nset position (LP):%d", Left_Pos);
	//printf("\nset position (Right_Pos):%d", Right_Pos);
	//printf("\nset position (Left_Pos):%d", Left_Pos);
	
	Right=RV;
	Left=LV;
	
 	Right_Acc=RA;
 	Left_Acc=LA;
	
	Right_Trajectory_Cntrl=0x002B;
	Left_Trajectory_Cntrl=0x002B;
			
	/*Calculations and coding of velocity and acceleration*/
	Vectors_Coding();
		
	for(channel=0;channel<2;channel++)
	{
		_initialize(channel);
		_set_filter(channel,(int)Filter_Cntrl,(int)Kp,(int)Ki,(int)Kd,(int)Il);
		if(channel==0)
			_set_traject(channel,(int)Right_Trajectory_Cntrl,(long int)Right_Acceleration,(long int)Right_Vel,(long int)Right_Pos);
		else
			_set_traject(channel,(int)Left_Trajectory_Cntrl,(long int)Left_Acceleration,(long int)Left_Vel,(long int)Left_Pos);
	} 
	if(Fir == 1)
	{
		Fir = 2;
		return;
	}
	if(Fir == 2)
	{
		Read_Right_Position();
		Read_Left_Position();
		
		interval_time = ( ( clock () - timer ));
		timer = clock ();
		
		if(interval_time !=0)
		{			
			OldRight_Position = Right_Position;
			OldLeft_Position = Left_Position;
			
			SpotTurnAngleCalculate ( AnglePosition );
		}
		return;
	}
	//fclose(Pos);    
}

/*********************************************************************************************
*	Check if bit is busy before transmission												 *
*********************************************************************************************/
void Check_Trajectory_Complete(void)
{
	int temp;

	for(;;)
	{
    	set_PS(COMMAND);
    	temp = inp(ESC_BASE+0);     // Read trajectory complete bit of channel 1
    	
    	if(temp & 0x04)
    		break;
    }
    
    for(;;)
	{
    	set_PS(COMMAND);
    	temp = inp(ESC_BASE+1);     // Read trajectory complete bit of channel 2
    	
    	if(temp & 0x04)
    		break;
    }
}

void StopSetPosition (void)
{
	delay(150);
	SetPosition(0, 0, 0, 0, 0);
	Check_Trajectory_Complete();
}

/*********************************************************************************************
*	Set the velocity of the motor							 							 *
*********************************************************************************************/
void SetVelocity(float RV, float LV)
{
	/*Right Trajestory control="0808H", indicates forward direction*/
	/*Left Trajestory control="1808H", indicates reverse direction*/
	/*Acceleration has already loaded, need not to be reloaded again*/
				
	Right=RV;
	Left=LV;
	
	if(Right<0)	//-ve number indicates reverse direction
	{
		Right_Trajectory_Cntrl=0x1808;	//Reverse direction
		Right=(-1)*Right;
	}
	else
		Right_Trajectory_Cntrl=0x0808;	//Forward direction
				
	if(Left<0)	//-ve number indicates reverse direction
	{
		Left_Trajectory_Cntrl=0x0808;	//Reverse direction
		Left=(-1)*Left;
	}
	else
		Left_Trajectory_Cntrl=0x1808;	//Forward direction
			
	/*Calculations and coding of velocity and acceleration*/
	Vectors_Coding();
		
	_set_traject(0,(int)Right_Trajectory_Cntrl,(long int)Right_Acceleration,(long int)Right_Vel,(long int)Right_Pos);
	_set_traject(1,(int)Left_Trajectory_Cntrl,(long int)Left_Acceleration,(long int)Left_Vel,(long int)Left_Pos);

	if(Fir == 1)
	{
		Fir = 2;
		return;
	}
	if(Fir == 2)
	{
		Read_Right_Position();
		Read_Left_Position();	
		
		interval_time = ( ( clock () - timer ));
		
		if(interval_time !=0)
		{
			timer = clock ();
			Right_Velocity = ( ( Right_Position - OldRight_Position ) / ( interval_time / 1000.0 ) );
			Left_Velocity = ( ( Left_Position - OldLeft_Position ) / ( interval_time / 1000.0 ) );
		
			OldRight_Position = Right_Position;
			OldLeft_Position = Left_Position;
			calculate_map ( Right_Velocity , Left_Velocity );
		}
		return;
	}
	
}

/*********************************************************************************************
*RZL: Set speed to zero and stop motor normally												 *
*********************************************************************************************/
void Motor_Stop(void)
{
 	SetVelocity(0,0);//set the speed of the motor to '0'
}

void Left90Turn(void)
{
	Motor_Stop();
	delay(180);
	SetPosition( 10.6275, -10.6275, 20, 20, 90.0 );
	Check_Trajectory_Complete();
	StopSetPosition();
}

/*********************************************************************************************
*	Initialize the motors in a stay still condition with torque								 *
*********************************************************************************************/
void Initialize_Motor(void)
{
	Right_Acc=14;				//Set the acceleration as 14rev/s/s
	Left_Acc=14;
	
	Right_Trajectory_Cntrl=0x0828;	//Indicate both motors are ready to move forward
	Left_Trajectory_Cntrl=0x1828;	//Indicate acceleration will be loaded
	
	outp(ESC_BASE+0x02,0x01);
	// Host reset connected to chips
	// LM629 drive selected for motors
	// PS bit 03, 1 after reset (data mode)
				
	/*Calculations and coding of velocity and acceleration*/
	Vectors_Coding();
	
	for(channel=0;channel<2;channel++)
	{
		_initialize(channel);
		_set_filter(channel,(int)Filter_Cntrl,(int)Kp,(int)Ki,(int)Kd,(int)Il);
		if(channel==0)
			_set_traject(channel,(int)Right_Trajectory_Cntrl,(long int)Right_Acceleration,(long int)Right_Vel,(long int)Right_Pos);
		else
			_set_traject(channel,(int)Left_Trajectory_Cntrl,(long int)Left_Acceleration,(long int)Left_Vel,(long int)Left_Pos);
	}        
}

/**********************************************************************
 * Name: Main                                                         *
 **********************************************************************/

void main()
{
	Initialize_Motor();

/**********User Code Section**********/
while(1)
	{
		SetPosition(11.0,11.0,20,20,0.0);
		Check_Trajectory_Complete();
		StopSetPosition();
		SetVelocity(30.0,30.0);
		delay(3000);
		Left90Turn();
	}
/***************End*******************/
}

This is the DOS3 header file which i have edited to clear some errors i encountered.

CPP / C++ / C Code:
/*	dos.h

	Defines structs, unions, macros, and functions for dealing
	with MSDOS and the Intel iAPX86 microprocessor family.

        Copyright (c) Borland International 1987,1988,1990
	All Rights Reserved.
*/
#ifndef __DOS_H
#define __DOS_H

#if __STDC__
#define _Cdecl
#else
#define _Cdecl	cdecl
#endif

#ifndef __PAS__
#define _CType _Cdecl
#else
#define _CType pascal
#endif

/* Variables */
extern	int		const _Cdecl _8087;
extern	int		_Cdecl _argc;
extern	char	      **_Cdecl _argv;
extern	char	      **_Cdecl  environ;

extern	int		_Cdecl _doserrno;

extern	unsigned	_Cdecl _heaplen;
extern	unsigned char	_Cdecl _osmajor;
extern	unsigned char	_Cdecl _osminor;
extern	unsigned 	_Cdecl _psp;
extern	unsigned	_Cdecl _stklen;
extern	unsigned	_Cdecl _fpstklen;
extern	unsigned 	_Cdecl _version;

#define FA_RDONLY	0x01		/* Read only attribute */
#define FA_HIDDEN	0x02		/* Hidden file */
#define FA_SYSTEM	0x04		/* System file */
#define FA_LABEL	0x08		/* Volume label */
#define FA_DIREC	0x10		/* Directory */
#define FA_ARCH		0x20		/* Archive */

#define NFDS	20			/* Maximum number of fds */

struct	fcb	{
	char	fcb_drive;		/* 0 = default, 1 = A, 2 = B */
	char	fcb_name[8];		/* File name */
	char	fcb_ext[3];		/* File extension */
	short	fcb_curblk;		/* Current block number */
	short	fcb_recsize;		/* Logical record size in bytes */
	long	fcb_filsize;		/* File size in bytes */
	short	fcb_date;		/* Date file was last written */
	char	fcb_resv[10];		/* Reserved for DOS */
	char	fcb_currec;		/* Current record in block */
	long	fcb_random;		/* Random record number */
};

struct	xfcb	{
	char		xfcb_flag;	/* Contains 0xff to indicate xfcb */
	char		xfcb_resv[5];	/* Reserved for DOS */
	char		xfcb_attr;	/* Search attribute */
	struct	fcb	xfcb_fcb;	/* The standard fcb */
};

struct  COUNTRY {
	int	co_date;
	char	co_curr[5];
	char	co_thsep[2];
	char	co_desep[2];
	char	co_dtsep[2];
	char	co_tmsep[2];
	char	co_currstyle;
	char	co_digits;
	char	co_time;
	long	co_case;
	char	co_dasep[2];
	char	co_fill[10];
};

struct	DOSERROR {
        int     de_exterror;
        int     de_class;
        char    de_action;
        char    de_locus;
};

struct	dfree	{
	unsigned df_avail;
	unsigned df_total;
	unsigned df_bsec;
	unsigned df_sclus;
};

struct	fatinfo {
	char	fi_sclus;
	char	fi_fatid;
	int	fi_nclus;
	int	fi_bysec;
};

struct	devhdr	{
	long		dh_next;	/* Next device pointer */
	short		dh_attr;	/* Attributes */
	unsigned short	dh_strat;	/* Driver strategy routine */
	unsigned short	dh_inter;	/* Driver interrupt routine */
	char		dh_name[8];	/* Device name */
};

struct	time	{
	unsigned char	ti_min;		/* Minutes */
	unsigned char	ti_hour;	/* Hours */
	unsigned char	ti_hund;	/* Hundredths of seconds */
	unsigned char	ti_sec;		/* Seconds */
};

struct	date	{
	int		da_year;        /* Year - 1980 */
	char		da_day;		/* Day of the month */
	char		da_mon;		/* Month (1 = Jan) */
};

struct WORDREGS {
	int ax, bx, cx, dx;
	int si, di, cflag, flags;
};

struct BYTEREGS {
	unsigned char al, ah, bl, bh;
	unsigned char cl, ch, dl, dh;
};

union REGS {
	struct WORDREGS x;
	struct BYTEREGS h;
};

struct  SREGS	{
	unsigned int    es;
	unsigned int	cs;
	unsigned int	ss;
	unsigned int	ds;
};

struct  REGPACK {
	unsigned	r_ax, r_bx, r_cx, r_dx, r_bp;
	unsigned	r_si, r_di, r_ds, r_es, r_flags;
};

typedef struct {
	char	ds_drive;	   /* do not change	   */
	char	ds_pattern [13];   /*  these fields,	   */
	char	ds_reserved [7];   /*	Microsoft reserved */
	char	ds_attrib;
	short	ds_time;
	short	ds_date;
	long	ds_size;
	char	ds_nameZ [13];	   /* result of the search, asciiz */
}	dosSearchInfo;	/* used with DOS functions 4E, 4F	*/


#ifdef __cplusplus
extern "C" {
#endif
/*
int	 _Cdecl absread	(int __drive, int __nsects, long __lsect, void *__buffer);
int	 _Cdecl abswrite(int __drive, int __nsects, long __lsect, void *__buffer);
int	 _Cdecl allocmem(unsigned __size, unsigned *__segp);
int	 _CType bdos	(int __dosfun, unsigned __dosdx, unsigned __dosal);
int	 _Cdecl bdosptr	(int __dosfun, void *__argument, unsigned __dosal);
struct  COUNTRY *_Cdecl country (int __xcode, struct COUNTRY *__cp);
void     _Cdecl ctrlbrk	(int _Cdecl (*handler)(void));
void     _Cdecl delay	(unsigned __milliseconds);
void     _Cdecl disable	(void);
int	     _Cdecl dosexterr	(struct DOSERROR *__eblkp);
long     _Cdecl dostounix	(struct date *__d, struct time *__t);
void            __emit__();
void     _Cdecl enable	(void);
int	     _Cdecl freemem	(unsigned __segx);
int	     _Cdecl getcbrk	(void);
void     _CType getdate	(struct date *__datep);
void     _Cdecl getdfree(unsigned char __drive, struct dfree *__dtable);
void     _Cdecl getfat	(unsigned char __drive, struct fatinfo *__dtable);
void     _Cdecl getfatd	(struct fatinfo *__dtable);
unsigned _Cdecl getpsp	(void);
int	     _Cdecl getswitchar	(void);
void     _CType gettime	(struct time *__timep);
int	     _Cdecl getverify	(void);
void     _Cdecl harderr	(int _Cdecl (*handler)());
void     _Cdecl hardresume	(int __axret);
void     _Cdecl hardretn(int __retn);
int	     _Cdecl inport	(int __portid);
unsigned char	_Cdecl inportb(int __portid);
int	 _Cdecl int86	(int __intno, union REGS *__inregs, union REGS *__outregs);
int	 _Cdecl int86x	(int __intno, union REGS *__inregs, union REGS *__outregs,
		        	 struct SREGS *__segregs);
int	 _Cdecl intdos	(union REGS *__inregs, union REGS *__outregs);
int	 _Cdecl intdosx	(union REGS *__inregs, union REGS *__outregs,
        			 struct SREGS *__segregs);
void	 _Cdecl intr	(int __intno, struct REGPACK *__preg);
void	 _Cdecl keep	(unsigned char __status, unsigned __size);
void 	 _Cdecl nosound	(void);
*/
void	 _Cdecl outport	(int __portid, int __value);
void	 _Cdecl outportb(int __portid, unsigned char __value);
/*char	*_Cdecl parsfnm	(const char *__cmdline, struct fcb *__fcb, int __opt);
int	     _Cdecl peek	(unsigned __segment, unsigned __offset);
char	 _Cdecl peekb	(unsigned __segment, unsigned __offset);
void	 _Cdecl poke	(unsigned __segment, unsigned __offset, int __value);
void	 _Cdecl pokeb	(unsigned __segment, unsigned __offset, char __value);
int	     _Cdecl randbrd	(struct fcb *__fcb, int __rcnt);
int	     _Cdecl randbwr	(struct fcb *__fcb, int __rcnt);
void	 _Cdecl segread	(struct SREGS *__segp);
int	     _Cdecl setblock(unsigned __segx, unsigned __newsize);
int	     _Cdecl setcbrk	(int __cbrkvalue);
void	 _Cdecl setdate	(struct date *__datep);
void	 _Cdecl setswitchar	(char __ch);
void	 _Cdecl settime	(struct time *__timep);
void	 _Cdecl setverify	(int __value);
void	 _Cdecl sleep	(unsigned __seconds);
void 	 _Cdecl sound	(unsigned __frequency);
void	 _Cdecl unixtodos	(long __time, struct date *__d, struct time *__t);
int	     _CType	unlink	(const char *__path);
*/
	/* These are in-line functions.  These prototypes just clean up
	   some syntax checks and code generation.
	 */

/*void	_Cdecl	        __cli__		(void);
void	_Cdecl	        __sti__		(void);
void	_Cdecl          __int__		(int __interruptnum);
*/
unsigned char	_Cdecl  __inportb__ (int __portid);
void	 _Cdecl         __outportb__(int __portid, unsigned char __value);

/*#define disable() __emit__( (char)(0xfa) )
#define enable()  __emit__( (char)(0xfb) )
*/
//#define geninterrupt(i) __int__(i)		/* Interrupt instruction */

#define outportb        __outportb__
#define inportb         __inportb__

/* some other compilers use inp, outp for inportb, outportb */
#define inp(portid)	inportb(portid)
#define outp(portid,v)	outportb(portid,v)

/*extern	unsigned	_Cdecl	_ovrbuffer;

#if !__STDC__
int cdecl far _OvrInitEms( unsigned __emsHandle, unsigned __emsFirst, unsigned __emsPages );
int cdecl far _OvrInitExt( unsigned long __extStart, unsigned long __extLength );

char far *cdecl getdta(void);
void	  cdecl setdta(char far *__dta);

#define MK_FP(seg, ofs)	((void _seg *)(seg) + (void near *)(ofs))
#define FP_SEG(fp)      ((unsigned)(void _seg *)(void far *)(fp))
#define FP_OFF(fp)      ((unsigned)(fp))

#ifdef __cplusplus
void	interrupt	(far * _CType getvect(int __interruptno)) (...);
void	_CType setvect (int __interruptno, void interrupt (far *__isr) (...));
int  inline _Cdecl peek(unsigned __segment, unsigned __offset)	
                   { return (*((int  far*)MK_FP(__segment, __offset))); }
char inline _Cdecl peekb(unsigned __segment, unsigned __offset) 
                   { return (*((char far*)MK_FP(__segment, __offset))); }
void inline _Cdecl poke(unsigned __segment, unsigned __offset, int __value)  
                   { (*((int  far*)MK_FP(__segment, __offset)) = __value); }
void inline _Cdecl pokeb(unsigned __segment, unsigned __offset, char __value)   
                   { (*((char far*)MK_FP(__segment, __offset)) = __value); }
#else
void	interrupt 	(far * _CType getvect(int __interruptno)) ();
void    _CType setvect (int __interruptno, void interrupt (far *__isr) ());
#define peek(a,b)	    (*((int  far*)MK_FP((a),(b))))
#define peekb(a,b)	    (*((char far*)MK_FP((a),(b))))
#define poke(a,b,c)	    (*((int  far*)MK_FP((a),(b))) = (int)(c))
#define pokeb(a,b,c)	(*((char far*)MK_FP((a),(b))) = (char)(c))

#endif

#endif
#ifdef __cplusplus
}
#endif*/

#endif

When i try to make a EXE file, it prompt mi 2 linker errors which are:

Linker Error: Undefined Symbol _Calculate_Map in module DESSY2.CPP
Linker Error: Undefined Symbol _SpotTurnAngleCalculate in module DESSY2.CPP

Can anyone point out where i have done wrong ?
Grateful for any help~
  #2  
Old 26-Mar-2007, 06:03
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,233
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: need help with linker problem


I see the prototype, and the point where the function is called...but where are those two functions actually defined, in another file or are they missing?
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #3  
Old 26-Mar-2007, 08:09
calin86 calin86 is offline
New Member
 
Join Date: Mar 2007
Posts: 4
calin86 is on a distinguished road

Re: need help with linker problem


I can only find those 2 which are define under 1 of the header file:

CPP / C++ / C Code:
#ifndef MappingsH
#define MappingsH

#define pi  3.141592654

	typedef struct  {
						float x;
						float y;
						float q;					
					}POST;

	extern POST current, previous, last, now;
	extern int x;
	extern int y;
	extern int Initilize_Map (void);
	extern int playing_timer(void);
	extern int getangle(void);
	extern int playing_timer2(void); //reset time only

	extern int SetPositionX ( float xcoo );
	extern int SetPositionY ( float ycoo );
	extern int SetPositionQ ( float qcoo );

	extern int SetPositionXp ( float xcop );
	extern int SetPositionYp ( float ycop );



	extern void calculation(void);

	extern int Fir, turn_dir, region;
	
	extern float preset_Q, Final_Angle;

	extern int clock_t_timer;
	extern int interval_time;

	extern int Calculate_Map ( float VRc, float VLc);
	extern int SpotTurnAngleCalculate ( float );

	extern void TimerDelay( unsigned long );
	//***
	
	extern void Check_Reset ( void );
	extern void platform_region( void );
	extern void Dispose_Angle(void);


	extern char l, r;
	
#endif

i assume that it was extern thats why i didnt include the header file in my program. Should i include it ? or am i missing anything ?
  #4  
Old 26-Mar-2007, 11:09
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,233
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: need help with linker problem


Is there a "mappings.c" file, if not then I would guess there must be a .lib that needs to be linked.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #5  
Old 26-Mar-2007, 18:41
calin86 calin86 is offline
New Member
 
Join Date: Mar 2007
Posts: 4
calin86 is on a distinguished road

Re: need help with linker problem


There is a New_Mapping.cpp file which is here:

CPP / C++ / C Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <dos.h>
#include <bios.h>
#include <signal.h>
#include <ctype.h>
#include <time.h>
#include <math.h>

#include "Mappings3.h"
#include "ESC629.h"
#include "Main.h"

#include "Dc.h"
#include "Searching3.h"
#include "communicate.h"
#include "Serial.h"
#include "Initialization.h"
#include "Big_Servo_Control.h"
#include "Dispose3.h"

int region =0;
int angle;
float Lc = 13.64;
float Angle_turn_tim;

void Check_Reset( void )
{
	int angle;		
	angle = PositionCheck();
		
	if(current.x < -220)		// individual reset
	{
		SetPositionXp(-222.5);
	}
	
	else if(current.x > -10)
	{
		SetPositionXp(-7.5);
	}
		   	
	else if(current.y > 220)
	{
		SetPositionYp(222.5); 	
	}
	
	else if(current.y < 10)
	{
		SetPositionYp(7.5); 	
	}
			
// 	SetVelocity( -8.0 , -8.0 );//move backward ar? 
// 	TimerDelay(1000000);
// 	SetVelocity ( 0.0 , 0.0 );
		
	if(current.x < -215.0)		// individual reset
	{
		SetPositionXp(-215.0);
	}
	
	else if(current.x > -15.0)
	{
		SetPositionXp(-15.0);
	}
		   	
	else if(current.y > 215.0)
	{
		SetPositionYp(215.0); 	
	}

	else if(current.y < 15)
	{
		SetPositionYp(15.0); 	
	}
	//this program will lost track of the coordiates ar ????
/******************************************************************************************************************************/		
	//platform_region();		// Robot check its location at platform
	
/****************************************************************************************************************/			
	if ( ( current.x < -21.0 && current.x > -203.0 ) && ( angle < 110.0 && angle > 70.0 ))//from -15cm to -195cm
	{				
		SetPositionY(219.0); //set Y position to 223cm
		SetPositionYp(219.0);		
		SetPositionQ(90.0);				
	}
			
	else if ( ( current.x < -27.0 && current.x > -209.0 ) && ( angle < 290.0 && angle > 250.0 ) )//from -21 to -201cm
	{	
		SetPositionY(11.0);
		SetPositionYp(11.0);		
		SetPositionQ(270.0);					
	}
	
	else if ( ( current.y > 25.0 && current.y < 210.0 ) && ( angle < 20.0 || angle > 340.0 ) )//Y pos from 21 to 201cm
	{		
		SetPositionX(-11.0);	//set X pos to 0cm
		SetPositionXp(-11.0);				
		SetPositionQ(0.0);				
	}
			
	else if ( ( current.y > 20.0 && current.y < 205.0 ) && ( angle < 200.0 && angle > 160.0 ) )//Y pos from 15 to 195cm
	{																		   //& X pos less than -209cm
		SetPositionX(-219.0); //set X pos to -216cm	
		SetPositionXp(-219.0);					
		SetPositionQ(180.0);		
	}
// 	if ( ( current.x < - 38.0 && current.x > -191.0 ) && ( current.y >= 191.0  ) )//from -15cm to -195cm
// 	{				
// 		SetPositionY(219.0); //set Y position to 223cm
// 		SetPositionYp(219.0);		
// 		SetPositionQ(90.0);	
// 		SetPositionQc(90.0);			
// 	}
// 	else if ( ( current.x < -38.0 && current.x > -191.0 ) && ( current.y <= 38.0  ) )//from -21 to -201cm
// 	{	
// 		SetPositionY(11.0);
// 		SetPositionYp(11.0);		
// 		SetPositionQ(270.0);
// 		SetPositionQc(270.0);					
// 	}
// 	else if ( ( current.y > 38.0 && current.y < 191.0 ) && ( current.x >= - 38.0  ) )//Y pos from 21 to 201cm
// 	{		
// 		SetPositionX(-11.0);	//set X pos to 0cm
// 		SetPositionXp(-11.0);				
// 		SetPositionQ(0.0);	
// 		SetPositionQc(0.0);			
// 	}
// 	else if ( ( current.y > 38.0 && current.y < 191.0 ) && ( current.x <= - 191.0  ) )//Y pos from 15 to 195cm
// 	{																		   //& X pos less than -209cm
// 		SetPositionX(-219.0); //set X pos to -216cm	
// 		SetPositionXp(-219.0);					
// 		SetPositionQ(180.0);
// 		SetPositionQc(180.0);			
// 	}
	else
	{
		Motor_E_Stop();
		TimerDelay(20000);
		l = Check_Yellow_Line_Sensor() & 0x0F;	
		r = Check_Yellow_Line_Sensor() & 0xF0;
					
		if (l && r)
		{
			if(angle < 105.0 && angle > 75.0)		// force reset
			{	
				SetPositionY(219.0); //set Y position to 223cm
				SetPositionYp(219.0);
				SetPositionQ(90.0);					
			}
	
			else if(angle < 285.0 && angle > 255.0)
			{	
				SetPositionY(11.0);
				SetPositionYp(11.0);
				SetPositionQ(270.0);
			}
		   	
			else if(angle < 15.0 || angle > 345.0)
			{		
				SetPositionX(-11.0);	//set X pos to 0cm
				SetPositionXp(-11.0);
				SetPositionQ(0.0);					
			}
	
			else if(angle < 195.0 && angle > 165.0)
			{
				SetPositionX(-219.0); //set X pos to -216cm	
				SetPositionXp(-219.0);
				SetPositionQ(180.0); 	
			}
// 			if ( ( current.x < -38.0 && current.x > -191.0 ) && ( current.y >= 191.0  ) )//from -15cm to -195cm
// 			{				
// 				SetPositionY(219.0); //set Y position to 223cm
// 				SetPositionYp(219.0);		
// 				SetPositionQ(90.0);		
// 				SetPositionQc(90.0);		
// 			}
// 			else if ( ( current.x < -38.0 && current.x > -191.0 ) && ( current.y <= 38.0  ) )//from -21 to -201cm
// 			{	
// 				SetPositionY(11.0);
// 				SetPositionYp(11.0);		
// 				SetPositionQ(270.0);
// 				SetPositionQc(270.0);					
// 			}
// 			else if ( ( current.y > 38.0 && current.y < 191.0 ) && ( current.x >= - 38.0  ) )//Y pos from 21 to 201cm
// 			{		
// 				SetPositionX(-11.0);	//set X pos to 0cm
// 				SetPositionXp(-11.0);				
// 				SetPositionQ(0.0);	
// 				SetPositionQc(0.0);			
// 			}
// 			else if ( ( current.y > 38.0 && current.y < 191.0 ) && ( current.x <= -191.0  ) )//Y pos from 15 to 195cm
// 			{																		   //& X pos less than -209cm
// 				SetPositionX(-219.0); //set X pos to -216cm	
// 				SetPositionXp(-219.0);					
// 				SetPositionQ(180.0);	
// 				SetPositionQc(180.0);		
// 			}
			else
			{
				MoveBackward( 400 );
			}
		}							
	}
	
	return;
}	


void platform_region(void)// angle for region 
{	 
	GreenCompartmentFull = 0;  	
	region = 0;
	preset_Q = 0;
	
	delay(100);
	
	angle = PositionCheck();	
	SetPositionQ((angle));	
	SetPositionQc((angle));
	
	if( current.x <= -191.0  &&  current.y >= 191.0 )
	{
		region = 1;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 290.0;
		}
		else if(BlueCompartmentFull ==1)
		{
			preset_Q = 340.0;
		}
		
	}
		
	else if( ( current.x <= -153.0 && current.x > -191.0 ) && ( current.y >= 191.0 ) )
	{
		region = 2;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 280.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 70.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 340.0;
		}
		
	}
	
	else if( ( current.x <= -115.0 && current.x > -153.0 ) && ( current.y >= 191.0 ) )
	{
		region = 3;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 260.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 70.0;	
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 340.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 100.0;
		}
		
	}
	
	else if( ( current.x <= -76.0 && current.x > -115.0 ) && ( current.y >= 191.0 ) )
	{
		region = 4;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 245.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 80.0;	
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 330.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 110.0;
		}
		
	}
	
	else if( ( current.x <= -38.0 && current.x > -76.0 ) && ( current.y >= 191.0 ) )
	{
		region = 5;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 235.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 90.0;	
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 330.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 110.0;
		}
		
	}
			
	else if( (current.x >= -38.0 ) && ( current.y >= 191.0) )
	{
		region = 6;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 235.0;
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 275.0;/**/
		}
		
	}
			
	else if( (current.x >= -38.0 ) && ( current.y >= 153.0 && current.y < 191.0 ) )
	{
		region = 7;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 190.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 110.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 340.0;
		}
		
	}
	else if( ( current.x <= -38.0 && current.x > -76.0 ) && ( current.y >= 153.0 && current.y < 191.0 ) )
	{
		region = 8;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 190.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 340.0;	
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 100.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 340.0;
		}
		
	}
	
	else if( ( current.x <= -76.0 && current.x > -115.0 ) && ( current.y >= 153.0 && current.y < 191.0 ) )
	{
		region = 9;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 190.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 340.0;	
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 90.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 105.0;
		}
		
	}
	
	else if( ( current.x <= -115.0 && current.x > -153.0 ) && ( current.y >= 153.0 && current.y < 191.0 ) )
	{
		region = 10;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 190.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 340.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 95.0;
		}
		
	}
	
	else if( ( current.x <= -153.0 && current.x > -191.0 ) && ( current.y >= 153.0 && current.y < 191.0 ) )
	{
		region = 11;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 280.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 340.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 80.0;
		}
		
	}
	
	else if( ( current.x <= -191.0 ) && ( current.y >= 153.0 && current.y < 191.0 ) )
	{
		region = 12;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 350.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 60.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 345.0;
		}
		
	}
	else if( ( current.x <= -191.0  ) && ( current.y >= 115.0 && current.y < 153.0 ) )
	{
		region = 13;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 0.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 0.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 70.0;
		}
		
	}
	else if( ( current.x <= -153.0 && current.x > -191.0 ) && ( current.y >= 115.0 && current.y < 153.0 ) )
	{
		region = 14;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 100.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 5.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 75.0;
		}
		
	}
	
	else if( ( current.x <= -115.0 && current.x > -153.0 ) && ( current.y >= 115.0 && current.y < 153.0 ) )
	{
		region = 15;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 180.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 5.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 95.0;
		}
		
	}
	
	else if( ( current.x <= -76.0 && current.x > -115.0 ) && ( current.y >= 115.0 && current.y < 153.0 ) )
	{
		region = 16;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 180.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 90.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 355.0;
		}
		
	}
	
	else if( ( current.x <= -38.0 && current.x > -76.0 ) && ( current.y >= 115.0 && current.y < 153.0 ) )
	{
		region = 17;
	
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 180.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 100.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 355.0;
		}
		
	}
	
	else if( ( current.x >= -38.0  ) && ( current.y >= 115.0 && current.y < 153.0 ) )
	{
		region = 18;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 180.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 0.0;	
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 110.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 355.0;
		}
		
	}
	
	else if( ( current.x >= -38.0  ) && ( current.y >= 76.0 && current.y < 115.0 ) )
	{
		region = 19;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 180.0;
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 0.0;
		}
		
	}
	else if( ( current.x <= -38.0 && current.x > -76.0 ) && ( current.y >= 76.0 && current.y < 115.0 ) )
	{
		region = 20;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 180.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 90.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 5.0;
		}
		
	}
	
	else if( ( current.x <= -76.0 && current.x > -115.0 ) && ( current.y >= 76.0 && current.y < 115.0 ) )
	{
		region = 21;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 180.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 100.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 8.0;
		}
		
	}
	
	else if( ( current.x <= -115.0 && current.x > -153.0 ) && ( current.y >= 76.0 && current.y < 115.0 ) )
	{
		region = 22;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 180.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 70.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 8.0;
		}
		
	}
	
	else if( ( current.x <= -153.0 && current.x > -191.0 ) && ( current.y >= 76.0 && current.y < 115.0 ) )
	{
		region = 23;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 180.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 20.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 80.0;
		}
		
	}
	
	else if( ( current.x <= -191.0  ) && ( current.y >= 76.0 && current.y < 115.0 ) )
	{
		region = 24;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 0.0;
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 8.0;
		}
		
	}
	
	else if( ( current.x <= -191  ) && ( current.y >= 38.0 && current.y < 76.0 ) )
	{
		region = 25;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 15.0;
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 10.0;
		}
		
	}
	else if( ( current.x <= -153.0 && current.x > -191.0 ) && ( current.y >= 38.0 && current.y < 76.0 ) )
	{
		region = 26;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 10.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 70.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 12.0;
		}
		
	}
	
	else if( ( current.x <= -115.0 && current.x > -153.0 ) && ( current.y >= 38.0 && current.y < 76.0 ) )
	{
		region = 27;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 170.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 70.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 12.0;
		}
		
	}
	
	else if( ( current.x <= -76.0 && current.x > -115.0 ) && ( current.y >= 38.0 && current.y < 76.0 ) )
	{
		region = 28;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 170.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 80.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 12.0;
		}
		
	}
	
	else if( ( current.x <= -38.0 && current.x > -76.0 ) && ( current.y >= 38.0 && current.y < 76.0 ) )
	{
		region = 29;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 170.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 90.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 20.0;
		}
		
	}
	
	else if( ( current.x >= -38.0  ) && ( current.y >= 38.0 && current.y < 76.0 ) )
	{
		region = 30;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 170.0;
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 30.0;
		}
		
	}
	
	else if( ( current.x >= -38.0  ) && ( current.y < 38.0 ) )
	{
		region = 31;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 170.0;
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 120.0;
		}
		
	}
	else if( ( current.x <= -38.0 && current.x > -76.0 ) && ( current.y <= 38.0 ) )
	{
		region = 32;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 155.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 90.0;	
		}
		else if(BlueCompartmentFull == 1 && check2 == 2)
		{
			preset_Q = 70.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 100.0;
		}
		
	}
	
	else if( ( current.x <= -76.0 && current.x > -115.0 ) && ( current.y <= 38.0 ) )
	{
		region = 33;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 150.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 80.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 32.0;
		}
		
	}
	
	else if( ( current.x <= -115.0 && current.x > -153.0 ) && ( current.y <= 38.0 ) )
	{
		region = 34;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 105.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 70.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 35.0;
		}
		
	}
	
	else if( ( current.x <= -153.0 && current.x > -191.0 ) && ( current.y <= 38.0 ) )
	{
		region = 35;
		
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 80.0;
		}
		else if(BlueCompartmentFull == 1 && check2 == 1)
		{
			preset_Q = 70.0;	
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 35.0;
		}
		
	}
	
	else if( ( current.x <= -191.0  ) && ( current.y <= 38.0 ) )
	{
		region = 36;
		if(GreenCompartmentFull == 1)
		{
			preset_Q = 70.0;
		}
		else if(BlueCompartmentFull == 1)
		{
			preset_Q = 35.0;
		}		
	}
	
		
	return;
}


void Dispose_Angle(void)
{
	SetVelocity ( 0.0 , 0.0 );

	Angle_turn_tim = ( ( ( ( 2 * Final_Angle )  / 360 ) * 21.8 ) )*0.975;
	
	
	if(turn_dir == 0)
	{
		delay(180);
		SetPosition( Angle_turn_tim, ( Angle_turn_tim * (-1) ), 25, 25, Final_Angle );	//left turn
 		Check_Trajectory_Complete();
 		StopSetPosition();

	}
	
	else if(turn_dir == 1)
	{
		delay(180);
		SetPosition( ( Angle_turn_tim * (-1) ), Angle_turn_tim, 25, 25, ( Final_Angle * (-1) ) );	//right turn
	 	Check_Trajectory_Complete();
	 	StopSetPosition();
	}
	return;
}

i didnt include it as i found most of the code inside not that useful in my program. There is a Mapping lib file which i rename it to Map.lib. But i would like to know how do you actually use Turbo C++ 3.01 to link which specific files you want to link with ?
  #6  
Old 27-Mar-2007, 19:10
calin86 calin86 is offline
New Member
 
Join Date: Mar 2007
Posts: 4
calin86 is on a distinguished road

Re: need help with linker problem


Hi all again,

I tried commenting those two functions and it convert to a obj file successfully. I tried the 'Make EXE File' and the 'Link EXE File', and both worked!

But my teacher said that, that is not the way to link all the library files to the EXE file. He asked me to use the MS-DOS TLINK function, but he did not teach me how to really use it -_-|||.

So right now my big question is whether the 'Link EXE File' the same as the TLINK function in MS-DOS or is it different ?

Anyone can help ?

Many thanks
 
 

Recent GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Graphic problem in Unreal Tournament 2004 zerox Computer Software Forum - Games 10 09-Oct-2005 12:31
Runtime Problem involving "printf" in C Program supamakia C Programming Language 2 09-Oct-2005 10:09
a significant problem after installing Xp mohammad Computer Software Forum - Windows 10 09-Aug-2005 07:03
Another FX 5600 problem (but with details that might shed light on this) BobDaDuck Computer Hardware Forum 2 16-Apr-2004 07:53

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 01:37.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.