A little ambiguity issue that is causing a problem.


2004-10-29 06:55:35 AM
cppbuilder79
The Code:
for(double Y = PageAttributes->TopMargin;
Y <= (PageAttributes->Height - PageAttributes->BottomMargin);
Y += PageAttributes->MajorAxis)
{
graphics.DrawLine(&GridPen, PageAttributes->LeftMargin, Y,
PageAttributes->Width -
PageAttributes->RightMargin, Y);
}
The Error:
[C++ Error] EZDPage.cpp(52): E2015 Ambiguity between
'Gdiplus::Graphics::DrawLine(const Gdiplus::Pen *,float,float,float,float)'
and 'Gdiplus::Graphics::DrawLine(const Gdiplus::Pen *,int,int,int,int)'
The problem:
PageAttributes->LeftMargin, PageAttributes->Width and especially Y are all
double floating point values.
Question:
Is the compiler trying to tell me that it cannot determine which operator
loading to use? The GDI+ calls are defined as FLOAT but the double seems to
work when I replace any one of the parameters with say a 0.0f - How can I
force a particular operator loading and why doesn't the compiler know from
the data types?