Its been years since I did C++ and Im unsure what this is about.
I have a QT class Im inheriting from in my .h file:
class Mosfet : Q3CanvasRectangle
{
public:
Mosfet::Mosfet(const QRect &qr, Q3Canvas *canvas);
Mosfet::~Mosfet();
....etc
};
In my .cpp file I have:
Mosfet::Mosfet(const QRect &qr, Q3Canvas *canvas) :
Q3CanvasRectangle(canvas)
{
}
When I compile I get:
Mosfet.cpp: In constructor 'Mosfet::Mosfet(const QRect&,
Q3Canvas*)':
Mosfet.cpp:13: error: no matching function for call to
'Q3CanvasRectangle::Q3CanvasRectangle()'
/opt/qt41/include/Qt/q3canvas.h:565: note: candidates are:
Q3CanvasRectangle::Q3CanvasRectangle(int, int, int, int, Q3Canvas*)
/opt/qt41/include/Qt/q3canvas.h:564: note:
Q3CanvasRectangle::Q3CanvasRectangle(const QRect&, Q3Canvas*)
/opt/qt41/include/Qt/q3canvas.h:563: note:
Q3CanvasRectangle::Q3CanvasRectangle(Q3Canvas*)
/opt/qt41/include/Qt/q3canvas.h:561: note:
Q3CanvasRectangle::Q3CanvasRectangle(const Q3CanvasRectangle&)
My question is, why does the compiler say that there is no matching
function:
Mosfet.cpp:13: error: no matching function for call to
'Q3CanvasRectangle::Q3CanvasRectangle()'
when my initializer list is clearly Q3CanvasRectangle(canvas) ?
It appears to me it doesnt like my init list and is calling a default
ctor,
which of course isnt in the candidates list.
Can someone point out the err in my ways? :)
Thanks,
Jeff
PS using fedora core 4, gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)
QT 4.1 3 6578
Jeff wrote: Its been years since I did C++ and Im unsure what this is about.
I have a QT class Im inheriting from in my .h file:
class Mosfet : Q3CanvasRectangle
Privately inherited? Just checking...
{ public: Mosfet::Mosfet(const QRect &qr, Q3Canvas *canvas); Mosfet::~Mosfet();
...etc };
In my .cpp file I have:
Mosfet::Mosfet(const QRect &qr, Q3Canvas *canvas) : Q3CanvasRectangle(canvas) { }
When I compile I get: Mosfet.cpp: In constructor 'Mosfet::Mosfet(const QRect&, Q3Canvas*)': Mosfet.cpp:13: error: no matching function for call to 'Q3CanvasRectangle::Q3CanvasRectangle()'
Which line is '13'?
/opt/qt41/include/Qt/q3canvas.h:565: note: candidates are: Q3CanvasRectangle::Q3CanvasRectangle(int, int, int, int, Q3Canvas*) /opt/qt41/include/Qt/q3canvas.h:564: note: Q3CanvasRectangle::Q3CanvasRectangle(const QRect&, Q3Canvas*) /opt/qt41/include/Qt/q3canvas.h:563: note: Q3CanvasRectangle::Q3CanvasRectangle(Q3Canvas*) /opt/qt41/include/Qt/q3canvas.h:561: note: Q3CanvasRectangle::Q3CanvasRectangle(const Q3CanvasRectangle&)
My question is, why does the compiler say that there is no matching function: Mosfet.cpp:13: error: no matching function for call to 'Q3CanvasRectangle::Q3CanvasRectangle()'
when my initializer list is clearly Q3CanvasRectangle(canvas) ?
Are you sure it's the part of the initialiser list that your compiler is
complaining about?
It appears to me it doesnt like my init list and is calling a default ctor, which of course isnt in the candidates list.
Could it be that you also have a member of that type? Read FAQ 5.8.
Can someone point out the err in my ways? :)
As soon as you supply enough information.
Thanks, Jeff
PS using fedora core 4, gcc version 4.0.2 20051125 (Red Hat 4.0.2-8) QT 4.1
That's irrelevant.
V
Jeff wrote: Its been years since I did C++ and Im unsure what this is about.
when my initializer list is clearly Q3CanvasRectangle(canvas) ?
Does Q3CanvasRectangle have such a constructor?
--
Ian Collins.
>Does Q3CanvasRectangle have such a constructor?
yes.
I just found the problem. I had a leftover Q3CanvasRectangle
in my private area. UGH
Thanks guys This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Steve Canfield |
last post by:
When compiling the following code:
class Base
{
...
virtual void Fn(int x);
virtual void Fn(Base x);
};
class Derived : public Base
|
by: J Solowiej |
last post by:
Hi,
I am wondering: is it possible to pass pointer to member function (non
static) to initialize another class? For exmaple:
class X {
public:
typedef double (*F)(double);
X(F f) : f_(f) {}...
|
by: Chris Bruyere |
last post by:
Hi All, I just finished reading the FAQ page on fucntion points, for this
ng, and I just wanted to clarify something.
class MessageCenter
{
....
void addMessage(int i, Message* m);...
|
by: anoopsaha |
last post by:
Hi all,
I have a class X with a member function dump(). Now there is another
version of dump() which is globally defined in some third party include
file. From another member function of X, I wish...
|
by: PengYu.UT |
last post by:
I have the following program. The auto_ptr cause the compile error.
When I change auto_ptr to pointer, the error gone.
Would you please help me to understand what is wrong?
...
|
by: Nelis Franken |
last post by:
Good day.
I'm having trouble telling STL to use a member function to sort items
within the relevant class. The isLess() function needs to have access
to the private members of the Foo class to...
|
by: Lionel B |
last post by:
I have a function which takes a functor argument. I which to call it for a
functor which is actually a class member; this works fine, using
the mem_fun_ref and bind1st functions (see listing 1...
|
by: subramanian100in |
last post by:
Suppose we have a class named Test.
We have a function
void fn(Test arg);
When this function is called, what kind of
initialization - direct initialization or copy
initialization, happens to...
|
by: khalderon |
last post by:
I have a map and want to invoke an object member function over each
element:
typedef map<string, pair<int, int table_t;
table_t table;
class delay_analyzer {
void calculate_conn(pair<string,...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |