5

"painting/qpathclipper.cpp", line 1643.30: 1540-0274 (S) The name lookup for "fuzzyCompare" did not find a declaration.

"painting/qpathclipper.cpp", line 1643.30: 1540-1292 (I) Static declarations are not considered for a function call if the function is not qualified.

I'm trying to compile Qt 4.5.0 on xlC 9.0.0.4a, and getting the above compiler message for the following code:

static bool fuzzyCompare(qreal a, qreal b)
{
    return qFuzzyCompare(a, b);
}

template <typename InputIterator>
InputIterator qFuzzyFind(InputIterator first, InputIterator last, qreal val)
{
    while (first != last && !fuzzyCompare(qreal(*first), qreal(val))) //line 1643
        ++first;
    return first;
}
Community
  • 1
  • 1
Walter Nissen
  • 16,451
  • 4
  • 26
  • 27
  • 1
    See also [static function lookup from a template function issue with xlC](http://stackoverflow.com/q/17661308/33732) – Rob Kennedy Oct 14 '14 at 22:31

1 Answers1

6

The "static" keyword is in error here, fuzzyCompare should be declared just

bool fuzzyCompare(qreal a, qreal b)
Walter Nissen
  • 16,451
  • 4
  • 26
  • 27
  • 2
    For the record, this is not the case: functions which are internal to a compilation unit *should* be static, or else the symbol will be exported. Instead, the xlC error should be fixed by qualifying the use of the `fuzzyCompare` with the full name (including namespace) at the point of use. – Nicholas Wilson Feb 18 '14 at 09:05
  • 1
    Ooh, you're probably right. Striking the `static` got the compile to succeed, because I wasn't about to replace all calls to `fuzzyCompare` (now `qFuzzyCompare` in the 5.x series) in a 200MB tarball... – Walter Nissen Feb 18 '14 at 18:36
  • @WalterNissen: `find . -type d -exec grep -l "[^:]fuzzyCompare(" {} \; | sed -i "s/\([^:]\)fuzzyCompare(/\1fuzzy_namespace::fuzzyCompare(/g"` -- untested and off the top of my head, but you get the idea. ;-) – DevSolar Mar 10 '15 at 10:15