0

Anyone have a clue what would cause the compiler to complain about static members and functions and virtual functions ?

I've written a bunch of stuff with Qt in C++ without this problem. The only new thing is I've overrided a virtual function and created a few static data members and functions.

When I compile, it complains about the code generated by Qt.

Anyone have a clue about what I may be doing wrong?

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Mr.UNOwen
0

I think you are looking for a general answer, but its hard to tell without
seeing the code, so post relevant code, or if small enough, the whole code.

0

Well I narrowed my problems, of which I solved one of them. Turns out if you don't have any signals/slots and you place "Q_OBJECT" in your code, things screw up.

The other one appears when I assign a value to a static object. So is this correct...

....
{
   ClassName::StaticMemberName = something;
}

Also is there a way I can set things so I don't have to do "ObjectName:: " all the time?
What the general rule with static functions and members when dealling with headers and code files?

0

Once again I've solved one bug and got another....

So it turns out you need to define static member outside the class definition in the header file, but now I have another bug. Now when I include the header file, the compiler says "multiple definition of ...".

I have this at the top:

#ifndef PGBULB_H
#define PGBULB_H

and this on the bottom:

#endif

Anyone have a clue what I'm doing wrong?

This article has been dead for over six months. Start a new discussion instead.
Be sure to adhere to our posting rules.