Please find the error in program.nd correct it..C++

[b][red]This message was edited by coolbuddy at 2006-9-6 21:38:22[/red][/b][hr]
[b][red]This message was edited by coolbuddy at 2006-9-6 21:35:14[/red][/b][hr]
THE QUESTION OF THIS PROGRAM HAS BEEN POSTED UNDER THE TOPIC
QUESTION PLZ HELP ME...C++ ADT

/* Program used to compute some statistics of similarity
Standard deviation stdev:
sqrt(( sum of the square of each term - square of mean )/(n-1))
USE MOSS.CPP
-----------------------------------------------------
/*Declaring and initialsing variables*/
#include
#include
#include
#include
#include "Moss.h"
using namespace std;

/*Main function*/
int main()
{
Moss temp;
temp.input_values();
temp.calc();
temp.output_values();

return 0;
}

/*End of program*/

MOSS.CPP
===========================================

#include "Moss.h"
#include
#include
#include

void Moss::input_values()
{
/*Implementing vectors*/
int dummy;
string s;

getline(cin,s,'(');
cin>>dummy;
p1.push_back(dummy);

getline(cin,s,'(');
cin>>dummy;
p2.push_back(dummy);

getline(cin,s,' ');
cin>>dummy;
nline.push_back(dummy);

cout<<p1[0]<<p2[0]<<nline[0];
int n;
cin>>n;
}

/*End*/
MOSS.H
-------------------------------------------

// File: Moss.h
#include
using namespace std;
class Moss {

/*Declaring private and public functions of a class*/
private:
vector p1,p2,nline;

public:
void input_values();
void calc();
void output_values();

};





Comments

  • : [b][red]This message was edited by coolbuddy at 2006-9-6 21:38:22[/red][/b][hr]
    : [b][red]This message was edited by coolbuddy at 2006-9-6 21:35:14[/red][/b][hr]
    : THE QUESTION OF THIS PROGRAM HAS BEEN POSTED UNDER THE TOPIC
    : QUESTION PLZ HELP ME...C++ ADT
    :
    : /* Program used to compute some statistics of similarity
    : Standard deviation stdev:
    : sqrt(( sum of the square of each term - square of mean )/(n-1))
    : USE MOSS.CPP
    : -----------------------------------------------------
    : /*Declaring and initialsing variables*/
    : #include
    : #include
    : #include
    : #include
    : #include "Moss.h"
    : using namespace std;
    :
    : /*Main function*/
    : int main()
    : {
    : Moss temp;
    : temp.input_values();
    : temp.calc();
    : temp.output_values();
    :
    : return 0;
    : }
    :
    : /*End of program*/
    :
    : MOSS.CPP
    : ===========================================
    :
    : #include "Moss.h"
    : #include
    : #include
    : #include
    :
    : void Moss::input_values()
    : {
    : /*Implementing vectors*/
    : int dummy;
    : string s;
    :
    : getline(cin,s,'(');
    : cin>>dummy;
    : p1.push_back(dummy);
    :
    : getline(cin,s,'(');
    : cin>>dummy;
    : p2.push_back(dummy);
    :
    : getline(cin,s,' ');
    : cin>>dummy;
    : nline.push_back(dummy);
    :
    : cout<<p1[0]<<p2[0]<<nline[0];
    : int n;
    : cin>>n;
    : }
    :
    : /*End*/
    : MOSS.H
    : -------------------------------------------
    :
    : // File: Moss.h
    : #include
    : using namespace std;
    : class Moss {
    :
    : /*Declaring private and public functions of a class*/
    : private:
    : vector p1,p2,nline;
    :
    : public:
    : void input_values();
    : void calc();
    : void output_values();
    :
    : };
    :
    :
    :


    What is the problem with it, then?
  • [b][red]This message was edited by coolbuddy at 2006-9-7 1:54:42[/red][/b][hr]
    hi dude

    i got the following errors
    1) [Linker error] undefined reference to `Moss::calc()'
    2) [Linker error] undefined reference to `Moss::output_values()'
    3) ld returned 1 exit status
    4) C:CMhomecs1102cstudentAreau0508925cs1102clab2ex1Makefile.win [Build Error] [useMoss.exe] Error 1
    thanx


    : : [b][red]This message was edited by coolbuddy at 2006-9-6 21:38:22[/red][/b][hr]
    : : [b][red]This message was edited by coolbuddy at 2006-9-6 21:35:14[/red][/b][hr]
    : : THE QUESTION OF THIS PROGRAM HAS BEEN POSTED UNDER THE TOPIC
    : : QUESTION PLZ HELP ME...C++ ADT
    : :
    : : /* Program used to compute some statistics of similarity
    : : Standard deviation stdev:
    : : sqrt(( sum of the square of each term - square of mean )/(n-1))
    : : USE MOSS.CPP
    : : -----------------------------------------------------
    : : /*Declaring and initialsing variables*/
    : : #include
    : : #include
    : : #include
    : : #include
    : : #include "Moss.h"
    : : using namespace std;
    : :
    : : /*Main function*/
    : : int main()
    : : {
    : : Moss temp;
    : : temp.input_values();
    : : temp.calc();
    : : temp.output_values();
    : :
    : : return 0;
    : : }
    : :
    : : /*End of program*/
    : :
    : : MOSS.CPP
    : : ===========================================
    : :
    : : #include "Moss.h"
    : : #include
    : : #include
    : : #include
    : :
    : : void Moss::input_values()
    : : {
    : : /*Implementing vectors*/
    : : int dummy;
    : : string s;
    : :
    : : getline(cin,s,'(');
    : : cin>>dummy;
    : : p1.push_back(dummy);
    : :
    : : getline(cin,s,'(');
    : : cin>>dummy;
    : : p2.push_back(dummy);
    : :
    : : getline(cin,s,' ');
    : : cin>>dummy;
    : : nline.push_back(dummy);
    : :
    : : cout<<p1[0]<<p2[0]<<nline[0];
    : : int n;
    : : cin>>n;
    : : }
    : :
    : : /*End*/
    : : MOSS.H
    : : -------------------------------------------
    : :
    : : // File: Moss.h
    : : #include
    : : using namespace std;
    : : class Moss {
    : :
    : : /*Declaring private and public functions of a class*/
    : : private:
    : : vector p1,p2,nline;
    : :
    : : public:
    : : void input_values();
    : : void calc();
    : : void output_values();
    : :
    : : };
    : :
    : :
    : :
    :
    :
    : What is the problem with it, then?
    :



  • : 1) [Linker error] undefined reference to `Moss::calc()'
    : 2) [Linker error] undefined reference to `Moss::output_values()'
    Check Google or
    http://www.codepedia.com/1/CppLinkingError


    See ya,
    bilderbikkel

  • : [b][red]This message was edited by coolbuddy at 2006-9-7 1:54:42[/red][/b][hr]
    : hi dude
    :
    : i got the following errors
    : 1) [Linker error] undefined reference to `Moss::calc()'
    : 2) [Linker error] undefined reference to `Moss::output_values()'
    : 3) ld returned 1 exit status
    : 4) C:CMhomecs1102cstudentAreau0508925cs1102clab2ex1Makefile.win [Build Error] [useMoss.exe] Error 1
    : thanx


    Yes, because you haven't written those functions. Make them and the linker errors will go away.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories