Hi Sourya,
I am sending the error messages and the files as an attachment.
Please have a look and send your suggestions.
Thanks and bye

Sourangshu Bhattacharya
B.E. 4th year, Civil Engg.,
University of Roorkee.
This is a sample from my original program to pin point complilation/
linking problem. There is not output on running this program. This program
compiled and execited on Solais Unix by issuing command:
CC test.C individual.C parameter.C
a.out

But it is not compiled using gcc. The compilation message and listing of
files are given below. Oblige me by redering solution and poined my
mistake. 

Script started on Mon Nov 20 13:31:38 2000

[hsrai@civil161 test]$ g++ test.C individual.C parameter.C
/tmp/ccbivjpn.o: In function `individual::individual(void)':
/tmp/ccbivjpn.o(.text+0x19): undefined reference to `individual::stringLengthInd'
/tmp/ccbivjpn.o(.text+0x23): undefined reference to `individual::parameterNo'
/tmp/ccbivjpn.o(.text+0x2d): undefined reference to `individual::bestFit'
collect2: ld returned 1 exit status
[hsrai@civil161 test]$ cat test.C
#include "individual.h"

void main()
{
        individual p;
}
[hsrai@civil161 test]$ cat individual.h
// ----------------------------------------------------------------------
//
//                                      Individual.h
//
// ----------------------------------------------------------------------
#include <math.h>
#include "parameter.h"
class individual : public parameter
{
protected:
static  int stringLengthInd;
static int parameterNo;
float fitnessCurrent;
static float bestFit;

public:

individual();
};
[hsrai@civil161 test]$ cat individual.C
// ----------------------------------------------------------------------
//
//                                      Individual.cpp
//
// ----------------------------------------------------------------------
#include "individual.h"

//______________________________________________________________________

individual::individual()
{
fitnessCurrent = -100;
stringLengthInd = -100;
parameterNo = -100;
bestFit = -999.9;
}
//                                                       _______________

[hsrai@civil161 test]$ cat parameter.h
// ----------------------------------------------------------------------
//
//                                      Parameter.h
//
// ----------------------------------------------------------------------
#include <iostream.h>
const int NO_OF_PARAMETERS = 10;
const int MAX_BIN_BIT = 100;
const int POP_SIZE =  30;
class parameter
{
protected:

float currentValue;

public:
parameter();
void showData();
float return_cv();
void set_cv(float c_v);
};
//______________________________________________________________________

[hsrai@civil161 test]$ cat parameter.C
// ----------------------------------------------------------------------


//


//                                      Parameter.cpp


//


// ----------------------------------------------------------------------


#include "parameter.h"


parameter::parameter()


{


currentValue = -100;


}





void parameter::showData()


{ cout <<"\n Current Value is: "<< currentValue; }





float parameter::return_cv()


{ return currentValue; }





void parameter::set_cv(float c_v) { currentValue = c_v;}


[hsrai@civil161 test]$ exit

Script done on Mon Nov 20 13:33:05 2000

Reply via email to