Missing template instantiation

#1
template <typename ValueType>
Point<ValueType> Displays::logicalToPhysical (Point<ValueType> point, const Display* useScaleFactorOfDisplay)  const noexcept
{
    auto& display = useScaleFactorOfDisplay != nullptr ? *useScaleFactorOfDisplay
                                                       : findDisplayForPoint (point.roundToInt(), false);

    auto globalScale = Desktop::getInstance().getGlobalScaleFactor();

    Point<ValueType> logicalTopLeft  (display.totalArea.getX(),       display.totalArea.getY());
    Point<ValueType> physicalTopLeft (display.topLeftPhysical.getX(), display.topLeftPhysical.getY());

    return ((point - (logicalTopLeft * globalScale)) * (display.scale / globalScale)) + physicalTopLeft;
}

as per @Rail_Jon_Rogut this causes a linker error:

Displays::Display mainDisplay = Desktop::getInstance().getDisplays().getMainDisplay();

Point&lt;int&gt; coordinates = { 100, 100 };

coordinates = Desktop::getInstance().getDisplays().logicalToPhysical (coordinates, &amp;mainDisplay);

Looks like you guys forgot to explicitly instantiate the template in the cpp file?

0 Likes

#2

Compiles fine VS 2015 but fails to link in Xcode 8.x

Rail

0 Likes

#3

fails to link on Xcode 10.1 too

0 Likes

#4

Thanks, I’ll get that sorted out.

0 Likes