M
Massimo M.
hi, i'm a newbie of c++ and i have a strange problem with compiling a
c++ source
kdeveloper, gcc 4.2.4, slack.
i've 2 files, S3.cpp and S3.h
s3.h:
#include <ncurses.h>
#include <strings.h>
#include <stdio.h>
#include <vector>
#include <form.h>
using namespace std;
....
class campo
{
public:
campo()
{
fldInp=new_field(1, 1, 1, 1, 0, 0);
}
campo(int intXInp, int intYInp, int intLungInp, int intAltInp,
TipoCampo tcInp,InputCampo icInp, char *chrInit)
{
fldInp=new_field(intAltInp, intLungInp, intYInp, intXInp, 0, 0);
};
private:
FIELD *fldInp;
TipoCampo tcCampo;
};
class s3{
public:
s3();
~s3();
void reset();
private:
vector<campo> campi;
};
s3.cpp
#include "s3.h"
s3::s3()
{
initscr();
....
}
s3::~s3()
{
clear();
endwin();
}
void s3::reset()
{
....
}
the problem is in the "campo" class
as you see, ther are two constructors. one with parameters, one
without parameters.
they do the same thing, but gcc say:
s3.o: In function `campo':
/home/max/source/produzione/masks/src/s3.h:24: undefined reference to
`new_field'
i don't understand. i cut and paste the function "fldInp=new_field(1,
1, 1, 1, 0, 0);" from the other constructor, but gcc don't like it.
c++ source
kdeveloper, gcc 4.2.4, slack.
i've 2 files, S3.cpp and S3.h
s3.h:
#include <ncurses.h>
#include <strings.h>
#include <stdio.h>
#include <vector>
#include <form.h>
using namespace std;
....
class campo
{
public:
campo()
{
fldInp=new_field(1, 1, 1, 1, 0, 0);
}
campo(int intXInp, int intYInp, int intLungInp, int intAltInp,
TipoCampo tcInp,InputCampo icInp, char *chrInit)
{
fldInp=new_field(intAltInp, intLungInp, intYInp, intXInp, 0, 0);
};
private:
FIELD *fldInp;
TipoCampo tcCampo;
};
class s3{
public:
s3();
~s3();
void reset();
private:
vector<campo> campi;
};
s3.cpp
#include "s3.h"
s3::s3()
{
initscr();
....
}
s3::~s3()
{
clear();
endwin();
}
void s3::reset()
{
....
}
the problem is in the "campo" class
as you see, ther are two constructors. one with parameters, one
without parameters.
they do the same thing, but gcc say:
s3.o: In function `campo':
/home/max/source/produzione/masks/src/s3.h:24: undefined reference to
`new_field'
i don't understand. i cut and paste the function "fldInp=new_field(1,
1, 1, 1, 0, 0);" from the other constructor, but gcc don't like it.