compiler error defineImage no match (upgrading to 0.5.0)

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
mba
Not too shy to talk
Not too shy to talk
Posts: 41
Joined: Tue Oct 11, 2005 11:54
Location: Denmark

compiler error defineImage no match (upgrading to 0.5.0)

Postby mba » Mon Jan 22, 2007 10:10

Hi

I'm trying to upgrade from 0.4.1 to 0.5.0 on my linux box, but I seem to be getting some compiler errors. First I had some difficulties finding out which dependencies I needed for the 0.5.0, this information isn't anywhere in the wiki or the forums?
Then I just downloaded the source from svn, and read the README which states that the only dependencies needed is freetype2 and PCRE, both of which I have installed on my system, along with all the dependencies for the 0.4.1 version, including devil.

The error I'm seeing is:

Code: Select all

g++ -DHAVE_CONFIG_H -I. -I. -I../include -I../include -I.. -I/usr/local/include/freetype2 -I/usr/local/include -g -O2 -MT CEGUIFreeTypeFont.lo -MD -MP -MF .deps/CEGUIFreeTypeFont.Tpo -c CEGUIFreeTypeFont.cpp  -fPIC -DPIC -o CEGUIFreeTypeFont.lo
CEGUIFreeTypeFont.cpp: In member function `virtual void
   CEGUI::FreeTypeFont::rasterize(unsigned int, unsigned int)':
CEGUIFreeTypeFont.cpp:281: error: parse error before `+' token
CEGUIFreeTypeFont.cpp:288: error: no matching function for call to `
   CEGUI::Imageset::defineImage(CEGUI::String&, CEGUI::Rect (&)(...),
   CEGUI::Point&)'
../include/CEGUIImageset.h:341: error: candidates are: void
   CEGUI::Imageset::defineImage(const CEGUI::String&, const CEGUI::Point&,
   const CEGUI::Size&, const CEGUI::Point&)
../include/CEGUIImageset.h:364: error:                 void
   CEGUI::Imageset::defineImage(const CEGUI::String&, const CEGUI::Rect&, const
   CEGUI::Point&)


Does anybody have a clue what is going on here?

Kind regards
Martin

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Mon Jan 22, 2007 21:00

Hi there,

i have not checked myself, but i think it's odd that it sais 'CEGUI::Rect (&)(...)' for the area parameter and the expected 'const&' typed for the String and the Point.

So it tries to map the 'CEGUI::Rect (&)(...)' onto a 'const Rect&'... I don't even know what that first construction means.

Maybe someone else has a guess?

User avatar
mba
Not too shy to talk
Not too shy to talk
Posts: 41
Joined: Tue Oct 11, 2005 11:54
Location: Denmark

Postby mba » Mon Jan 29, 2007 10:16

Hi again

thanks for replying scriptkid!
I have also no clue what the CEGUI::Rect (&)(...) construct means.
After trying a couple of things, I remembered that I tried 0.5.0 when it was a release candidate, so I downloaded the tar sourceball RC1 for linux, and voila! it builds just fine.

Kind regards
Martin

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Mon Jan 29, 2007 12:38

Glad to hear you got it to work!

You mean you are now using RC1? Because there is a 'real' release already:
http://prdownloads.sourceforge.net/cray ... z?download

But use the one which suits you best of course :-)

User avatar
mba
Not too shy to talk
Not too shy to talk
Posts: 41
Joined: Tue Oct 11, 2005 11:54
Location: Denmark

Postby mba » Tue Jan 30, 2007 07:37

hi again

this doesn't actually count as working :wink:, the problems I'm having is with the NEW release of cegui 0.5.0b... but as a test I tried the RC1, because I remembered that it had worked earlier, and it still does.
This could maybe give a hint of what is wrong, but I'm still at a loss here.


regards
Martin

User avatar
mba
Not too shy to talk
Not too shy to talk
Posts: 41
Joined: Tue Oct 11, 2005 11:54
Location: Denmark

Postby mba » Mon Feb 05, 2007 09:58

I have localized the problem and it has to do with this line where the area variable isn't properly constructed.

CEGUIFreeTypeFont.cpp line 281:

Code: Select all

Rect area(float(x), float(y),
float(x + glyph_w - INTER_GLYPH_PAD_SPACE),
float(y + glyph_h - INTER_GLYPH_PAD_SPACE));


whereas the version from release candidate 2

Code: Select all

Rect area(x, y,
x + glyph_w - INTER_GLYPH_PAD_SPACE,
y + glyph_h - INTER_GLYPH_PAD_SPACE);


works flawlessly.
The problem, I think, is the functional-style typecast of the float variables, this triggers a bug in my gcc/g++ 3.3.5 compiler (I'm guessing here, because I found a forum post where someone suggested that you upgrade from 3.2 to 3.4 because this bug was removed). If I change the typecast from

Code: Select all

float(x + glyph_w - INTER_GLYPH_PAD_SPACE)

to

Code: Select all

static_cast<float>(x + glyph_w - INTER_GLYPH_PAD_SPACE)

it works perfectly.

Kind regards
Martin

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Mon Feb 05, 2007 20:29

Hey,

good that you found it. I'll see if we can get patch this. Thanks for sharing the details! :-)

User avatar
mba
Not too shy to talk
Not too shy to talk
Posts: 41
Joined: Tue Oct 11, 2005 11:54
Location: Denmark

Postby mba » Thu Feb 08, 2007 12:00

Hi scriptkid

I don't actually think its a problem in cegui, I'm guessing at a bug in the gcc 3.3.5 compiler. But either way, why is there used so many different ways of typecasting throughout the cegui project, I think all variations is represented

(float), float(), static_cast<float>....

Kind regards
Martin Bang Andersen

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Fri Feb 09, 2007 14:48

I know it's not a cegui problem, but when changing the cast helps avoiding compiler errors, we might help in this area :-)

Not sure about all the different casts. The project is already a few years old and has different contributors. But you have a point: we might need to choose one way of doing this.

alphasnd
Just popping in
Just popping in
Posts: 7
Joined: Tue May 27, 2008 13:20

Postby alphasnd » Tue May 27, 2008 13:34

I just encountered this problem when compiling on OS X (and using gcc3.x), thanks to mba for the solution. Here is the patch if you want to apply it on over the 0.6.x branch:

Index: CEGUIFreeTypeFont.cpp
===================================================================
--- CEGUIFreeTypeFont.cpp (revision 1710)
+++ CEGUIFreeTypeFont.cpp (working copy)
@@ -279,8 +279,8 @@
drawGlyphToBuffer (mem_buffer + (y * texsize) + x, texsize);

// Create a new image in the imageset
- Rect area (float(x), float(y), float(x + glyph_w - INTER_GLYPH_PAD_SPACE),
- float(y + glyph_h - INTER_GLYPH_PAD_SPACE));
+ Rect area (static_cast<float>(x), static_cast<float>(y), static_cast<float>(x + glyph_w - INTER_GLYPH_PAD_SPACE),
+ static_cast<float>(y + glyph_h - INTER_GLYPH_PAD_SPACE));
Point offset (d_fontFace->glyph->metrics.horiBearingX * float(FT_POS_COEF),
-d_fontFace->glyph->metrics.horiBearingY * float(FT_POS_COEF));




With this, it compiles on OS X without any hickups.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Tue May 27, 2008 15:26

Hi, and welcome :)

I have applied this fix (slightly extended to include the Point definition immediately below the Rect) in branches/v0-6 at rev. 1729. Thanks very much :)

For reference, the actual patch applied was:

Code: Select all

Index: src/CEGUIFreeTypeFont.cpp
===================================================================
--- src/CEGUIFreeTypeFont.cpp   (revision 1724)
+++ src/CEGUIFreeTypeFont.cpp   (working copy)
@@ -279,11 +279,14 @@
                     drawGlyphToBuffer (mem_buffer + (y * texsize) + x, texsize);

                     // Create a new image in the imageset
-                    Rect area (float(x), float(y), float(x + glyph_w - INTER_GLYPH_PAD_SPACE),
-                               float(y + glyph_h - INTER_GLYPH_PAD_SPACE));
-                    Point offset (d_fontFace->glyph->metrics.horiBearingX * float(FT_POS_COEF),
-                                  -d_fontFace->glyph->metrics.horiBearingY * float(FT_POS_COEF));
+                    Rect area(static_cast<float>(x),
+                              static_cast<float>(y),
+                              static_cast<float>(x + glyph_w - INTER_GLYPH_PAD_SPACE),
+                              static_cast<float>(y + glyph_h - INTER_GLYPH_PAD_SPACE));

+                    Point offset(d_fontFace->glyph->metrics.horiBearingX * static_cast<float>(FT_POS_COEF),
+                                 -d_fontFace->glyph->metrics.horiBearingY * static_cast<float>(FT_POS_COEF));
+
                     String name;
                     name += s->first;
                     is->defineImage (name, area, offset);


CE.

alphasnd
Just popping in
Just popping in
Posts: 7
Joined: Tue May 27, 2008 13:20

Postby alphasnd » Wed May 28, 2008 09:34

Thanks for the quick fix, happy to be onboard :)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 5 guests