Page 1 of 1

Problem in ceguistring.h while compiling (VS2010)

Posted: Sat Jul 30, 2011 20:05
by Asura
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

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

Posted: Sat Jul 30, 2011 20:28
by ShadowTiger
Have you tried compiling and looking through the sample code? I used that as a base for my project, it helps avoid little mistakes.

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

Posted: Sun Jul 31, 2011 16:35
by MarkR
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".

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

Posted: Sun Jul 31, 2011 21:56
by Asura
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.

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

Posted: Mon Aug 01, 2011 07:46
by MarkR
... most probably because NOMINMAX is defined within a CEGUI header ;-)