Connect to a Wifi network - without c++11 (without 'auto')
-
Hi,
thanks for your help, it compiles without error now.
Unfortunately, it crashes at runtime (I do have added 'CONFIG += network' in my .pro file).
Weirdly, it doesn't crash on debug.If I comment this part :
ncs = ncm.allConfigurations(); foreach (const QNetworkConfiguration &configuration, ncs) { if(configuration.bearerType() == QNetworkConfiguration::BearerWLAN) { if(configuration.name() == "JBLiagre.com") { m_notif_ui->label_connexion->setStyleSheet("QLabel{color : green;}"); m_notif_ui->label_connexion->setText("Connecté à 'JBLiagre.com' !"); m_notif_ui->label_connexion->setAlignment(Qt::AlignCenter); cfg = configuration; } } }
It runs without any problem.
I am waiting for the IT departement to give me a Wifi-card so for the moment I do not have Wifi on my computer, could this be related ? -
@zarachbaal said:
cfg = configuration;
how and where is
cfg
defined and used??
Have you able to collect the crash dump?? -
My full code related to QtNetwork is :
#include <QtNetwork/QtNetwork> QNetworkConfiguration cfg; QNetworkConfigurationManager ncm; QList<QNetworkConfiguration> ncs; ncs = ncm.allConfigurations(); foreach (const QNetworkConfiguration &configuration, ncs) { if(configuration.bearerType() == QNetworkConfiguration::BearerWLAN) { if(configuration.name() == "test.com") { cfg = configuration; } } }
If I comment everything but :
#include <QtNetwork/QtNetwork> QNetworkConfiguration cfg; QNetworkConfigurationManager ncm; QList<QNetworkConfiguration> ncs; ncs = ncm.allConfigurations();
It crashes too.
What do you mean by "collecting the crash dump" ?
-
When you have a crash you generally get a stack trace (if you are using a debug build) so you can see where exactly the problem happened
-
Ok that's what I thought.
The problem is that in Debug mode (via F5 in Qt Creator), my program doesn't crash so I won't be able to post the crash dump.
I will try my program this evening on a computer that has a Wifi card to see if it changes anything.
-
Is the crash happening in Qt Creator with a release build ?
-
Yes it is
-
Qt4.8 :
Tier 1 Platforms
All Tier 1 platforms are subjected to our unit test suite and other internal testing tools on a frequent basis (prior to new version releases, source tree branching, and at other significant period points in the development process). Errors or bugs discovered in these platforms are prioritized for correction by the development team. Significant errors discovered in Tier 1 platforms can impact release dates and Qt Development Frameworks strives to resolve all known high priority errors in Tier 1 platforms prior to new version releases.
Platform Compilers
Ubuntu Linux 10.04 (32-bit) As provided by Ubuntu
Ubuntu Linux 11.10 (64-bit) As provided by Ubuntu
Microsoft Windows XP SP3 (32-bit) MSVC 2008
Microsoft Windows 7 (32-bit) MSVC 2008
Microsoft Windows 7 (32-bit) MSVC 2010 SP1
Apple Mac OS X 10.6 "Snow Leopard" (64-bit) As provided by Apple
Apple Mac OS X 10.7 "Lion" (64-bit) As provided by Apple
Tier 2 PlatformsTier 2 platforms are subject to ad hoc and internal testing. However, Qt users should note that errors may be present in released product versions for Tier 2 platforms and, subject to resource availability, known errors in Tier 2 platforms may or may not be corrected prior to new version releases.
Platform Compilers
Ubuntu Linux 10.04 QWS (x86 32-bit) As provided by Ubuntu
Ubuntu Linux 10.04 (32-bit) Intel Compiler [version 12]
Ubuntu Linux 10.04 (64-bit) As provided by Ubuntu
Microsoft Windows XP SP3 (32-bit) GCC 4.4 (MinGW)
Microsoft Windows XP SP3 (32-bit) MinGW-builds gcc 4.8.2 (32 bit)
Microsoft Windows 7 (64-bit) MSVC 2010 SP1
Apple Mac OS X 10.6 "Snow Leopard" Cocoa (32-bit) As provided by AppleI am not sure about other, but none of the Microsoft compilers listed provided full C++11
support.I know only one way to debug release code print out information on the screen.
-
I just created a new project and added the code above.
It works well, no errors or crashes.
So the problem is in my project, I will look into it but I do not see what could cause the problem.