Problem in ceguistring.h while compiling (VS2010)

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

Asura
Just popping in
Just popping in
Posts: 2
Joined: Sat Jul 30, 2011 19:56

Problem in ceguistring.h while compiling (VS2010)

Postby Asura » Sat Jul 30, 2011 20:05

Hi there,
I just found CEGui and want to implement it in my DX11 engine. Unfortunately, I get an error in ceguistring.h when trying to compile.

The VS error is as follows:

Code: Select all

d:\development libraries\cegui-sdk-0.7.5-vc10\include\cegui\ceguistring.h(1257): error C2589: '(' : illegal token on right side of '::'

d:\development libraries\cegui-sdk-0.7.5-vc10\include\cegui\ceguistring.h(1257): error C2059: syntax error : '::'


in the following code:

Code: Select all

   
size_type   utf8_stream_len(size_type num = npos, size_type idx = 0) const
{
   using namespace std;

   if (d_cplength < idx)
         CEGUI_THROW(out_of_range("Index was out of range for CEGUI::String object"));

   size_type   maxlen = d_cplength - idx;

   return encoded_size(&ptr()[idx], ceguimin(num, maxlen));
}


The error relates to the last line. Any idea why this would happen?

This is the code I am trying to compile:

Code: Select all

bool MyCeGui::Init()
{
   m_renderer = &CEGUI::Direct3D11Renderer::bootstrapSystem(g_Renderer.GetD3D11Device(),g_Renderer.GetImmediateContext());

   CEGUI::DefaultResourceProvider* rp = reinterpret_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider());

   return true;
}


Thx for any help

ShadowTiger
Quite a regular
Quite a regular
Posts: 46
Joined: Fri Mar 19, 2010 05:31

Re: Problem in ceguistring.h while compiling (VS2010)

Postby ShadowTiger » Sat Jul 30, 2011 20:28

Have you tried compiling and looking through the sample code? I used that as a base for my project, it helps avoid little mistakes.

MarkR
Quite a regular
Quite a regular
Posts: 64
Joined: Thu Jul 15, 2010 06:55

Re: Problem in ceguistring.h while compiling (VS2010)

Postby MarkR » Sun Jul 31, 2011 16:35

I could imagine that the ceguimin is defined as std::min while min itself is also defined by windef.h as (((a) < (b)) ? (a) : (b))
Try to #define NOMINMAX before you include any header and replace all your usages of "min" and "max" with "std::min" and "std::max".

Asura
Just popping in
Just popping in
Posts: 2
Joined: Sat Jul 30, 2011 19:56

Re: Problem in ceguistring.h while compiling (VS2010)

Postby Asura » Sun Jul 31, 2011 21:56

Thanks for all your suggestions, the problem is fixed and the cause was the order in which I included CEGUI files and my own engine files. Including my files last solved the problem.

MarkR
Quite a regular
Quite a regular
Posts: 64
Joined: Thu Jul 15, 2010 06:55

Re: Problem in ceguistring.h while compiling (VS2010)

Postby MarkR » Mon Aug 01, 2011 07:46

... most probably because NOMINMAX is defined within a CEGUI header ;-)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 15 guests