G3D::Material constructor issue

2 views
Skip to first unread message

Rob Patro

unread,
Jun 15, 2009, 9:50:27 PM6/15/09
to G3D Users
I run into the following error during compilation, and wonder if you
might be able to suggest what the problem may be:

'/usr/local/include/GLG3D/Material.h:152: error: unnamed initializer
for ‘G3D::Material’, which has no base classes'

I'm using g++-4.3.3 on ubuntu 9.04. It seems to be failing in the
initializer list when attempting to initialize the Component members.

Thanks,
Rob

Morgan McGuire

unread,
Jun 15, 2009, 9:54:27 PM6/15/09
to g3d-...@googlegroups.com
Which G3D version are you using?

-m

Rob Patro

unread,
Jun 16, 2009, 12:19:40 AM6/16/09
to G3D Users
I'm using 7.01; the latest stable release from SourceForge.

--Rob

On Jun 15, 9:54 pm, Morgan McGuire <morga...@gmail.com> wrote:
> Which G3D version are you using?
>
> -m
>

corey taylor

unread,
Jun 16, 2009, 1:01:36 AM6/16/09
to g3d-...@googlegroups.com
I've never seen that before.

I wonder if it's the vector initialization. What if you moved
customConstant into the constructor body?

Surely it wouldn't be the order of declaration in the class or
something like that.

corey

Rob Patro

unread,
Jun 16, 2009, 6:27:33 AM6/16/09
to G3D Users
I've tracked the problem down to a particular member, actually. If I
simply remove "emit" from the initialization list, the code complies
fine. However, with emit in the initialization list (or in the
constructor body!) , it fails to compile. Perhaps there is some form
of namespace pollution occurring? That behavior is strange indeed.

--Rob

On Jun 16, 1:01 am, corey taylor <corey.tay...@gmail.com> wrote:
> I've never seen that before.
>
> I wonder if it's the vector initialization.  What if you moved
> customConstant into the constructor body?
>
> Surely it wouldn't be the order of declaration in the class or
> something like that.
>
> corey
>

Rob Patro

unread,
Jun 16, 2009, 8:50:42 AM6/16/09
to G3D Users
Okay; I've figured it out. I'm using Qt in the same project in which
I am using G3D. Unfortunately, Qt defines the "emit" (lower case :-P)
macro for it's signal and slot mechanism. By #undef(ing) emit at the
beginning of Material.h, I can get rid of the compilation error. Is
it possible to temporarily #undef something, or to push and pop pre-
compiler directives? Obviously, I want Qt's emit properly defined
after the inclusion of G3D's Material.h.

Thanks,
Rob

Morgan McGuire

unread,
Jun 16, 2009, 10:51:17 AM6/16/09
to g3d-...@googlegroups.com
The easiest thing is to undef it before including G3D and then and then re-def it to the same thing afterward (or...just #include qt after G3D always).

"emit" is a pretty lame name for a macro.

-m

Prof. Morgan McGuire
Computer Science Department
Williams College
http://cs.williams.edu/~morgan

Rob Patro

unread,
Jun 16, 2009, 10:56:41 AM6/16/09
to G3D Users
Yea, that is my current solution. I agree that "emit" is a very lame
macro name indeed. I also think it simply expands to a NOP anyway.
Either way, Qt is a pretty widely used library; maybe you guys will
consider adding these define guards to a future version of G3D ( or
renaming emit to something else like emission)?

Thanks,
Rob

On Jun 16, 10:51 am, Morgan McGuire <morga...@gmail.com> wrote:
> The easiest thing is to undef it before including G3D and then and then
> re-def it to the same thing afterward (or...just #include qt after G3D
> always).
>
> "emit" is a pretty lame name for a macro.
>
> -m
>
> Prof. Morgan McGuire
> Computer Science Department
> Williams Collegehttp://cs.williams.edu/~morgan

Morgan McGuire

unread,
Jun 16, 2009, 12:38:40 PM6/16/09
to g3d-...@googlegroups.com
That whole class has been radically redesigned in 8.0.  Emit is now "EmissionFunction" and is a different class. There should be a beta release shortly, although you can always check out the latest from CVS.


-m

Prof. Morgan McGuire
Computer Science Department
Williams College
http://cs.williams.edu/~morgan


corey taylor

unread,
Jun 16, 2009, 9:18:06 PM6/16/09
to g3d-...@googlegroups.com
I remember working with Qt. The emit and slot keywords were used for
signaling. I wish they had simply pre-pended qt in front of those
defines though.

The G3D syntax (although not all has been converted) is to use the
prefix m_ for non-public member variables and no prefix for public
member variables where both use camel case. I don't imagine that
we'll run into too many keyword collisions. We can change anything
that has a disastrous collision in the current revision.

Most of the issues with libraries like Qt and G3D used together are
the basic type defines in the headers. That can only be solved with
proper include order or proper namespace use.

corey
Reply all
Reply to author
Forward
0 new messages