473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

member initialization - no matching function - candidates are

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

Jan 26 '06 #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
Jan 26 '06 #2
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.
Jan 27 '06 #3
>Does Q3CanvasRectangle have such a constructor?

yes.

I just found the problem. I had a leftover Q3CanvasRectangle
in my private area. UGH

Thanks guys

Jan 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
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
1
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) {}...
4
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);...
5
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...
4
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? ...
3
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...
2
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...
2
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...
5
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,...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.