[Qt-mobility-feedback] Reference to ‘QNetworkConfiguration’ is ambiguous when compiling for Nokia SDK simulator.

Aaron McCarthy aaron.mccarthy at nokia.com
Thu Jul 15 02:50:58 CEST 2010


Hi,

On Wednesday 14 July 2010 23:40:17 ext Olivier Fauchon wrote:
> But it fails when target is Nokia Simulator from Nokia SDK , with the
> following error:
> 
> ../OFLocator/OFlocator.cpp:209:32: error: template argument 1 is invalid
> ../OFLocator/OFlocator.cpp:209:52: error: invalid type in declaration
> before ‘=’ token
> ../OFLocator/OFlocator.cpp:209:87: error: cannot convert
> ‘QList<QtMobility::QNetworkConfiguration>’ to ‘int’ in initialization
> ../OFLocator/OFlocator.cpp:210:31: error: request for member ‘isEmpty’
> in ‘allConfigurations’, which is of non-class type ‘int’
> ../OFLocator/OFlocator.cpp:212:9: error: reference to
> ‘QNetworkConfiguration’ is ambiguous
> ../../../../NokiaQtSDK/Simulator/Qt/gcc/include/QtNetwork/qnetworkaccessman
> ager.h:65:7: error: candidates are: struct QNetworkConfiguration
> ../../../../NokiaQtSDK/Simulator/Qt/gcc/include/QtNetwork/qnetworkconfigura
> tion.h:72:1: error: class QtMobility::QNetworkConfiguration
> ../OFLocator/OFlocator.cpp:212:31: error: expected ‘;’ before ‘config’
> ../OFLocator/OFlocator.cpp:213:34: error: ‘config’ was not declared in
> this scope
> ../OFLocator/OFlocator.cpp: At global scope:
> ../OFLocator/OFlocator.cpp:463:6: warning: unused parameter ‘requestId’
> ../OFLocator/OFlocator.cpp:463:6: warning: unused parameter ‘error’

>From the build log you are building against a pre-released version of Qt 4.7.  
The bearer management classes are present in both mobility and Qt 4.7.  It is 
recommended that if you are building against Qt 4.7 that you use the bearer 
classes in Qt as they superceed the ones in Qt Mobility.  To ensure that you 
are using the bearer classes from Qt remove "bearer" from the MOBILITY 
variable in your .pro file.

What is causing the build failure in this case is that the compiler is unable 
to disambiguate between the declaration of QNetworkConfiguration in the 
qnetworkaccessmanager.h file (always uses the Qt version) and the actual 
definition in qnetworkconfiguration.h (the mobility version).  Possibly 
because you have a "using namespace QtMobility" somewhere in your code (or 
from a header file).

To fixed the build either use the Qt version or if you must use the mobility 
version explicity specify the namespace of the QNetworkConfiguration class, 
change:

QList<QNetworkConfiguration> allConfigurations = ...

to

QList<QtMobility::QNetworkConfiguration> allConfigurations = ...

I cannot explain why it builds on Maemo 5 while fails on the Qt Simulator, 
unless the Qt versions in the two build environments are different.

Cheers,

-- 
Aaron McCarthy, Software Engineer
Nokia, Qt Development Frameworks
Level 1, 53 Brandl St,
Brisbane Technology Park, Eight Mile Plains, 
QLD, Australia, 4113
http://qt.nokia.com/




More information about the Qt-mobility-feedback mailing list