argc change value when calling Qcoreapplication::arguments()
-
wrote on 11 Jan 2017, 02:34 last edited by
Hi,
I have a class App deriving from QApplication and
with contructor App::App( int& argc, char *argv[] )
In one of the member of the class App, I am doing
QStringList Args = QCoreApplication::arguments();
When I run my application I know that app is created with
argc at 0 anf argv at "" .
I have a crash when I call QCoreApplication::arguments().
I traced the problem until const int ac = self->d_func()->argc;
where ac will contain a value greater than 0 ( never the same).
I don't change argc at the application levelI see that argc and self->d_func()->argc have the same adress but I cannot see where argc value changed.
Any idea?Thierry
-
Hi,
I have a class App deriving from QApplication and
with contructor App::App( int& argc, char *argv[] )
In one of the member of the class App, I am doing
QStringList Args = QCoreApplication::arguments();
When I run my application I know that app is created with
argc at 0 anf argv at "" .
I have a crash when I call QCoreApplication::arguments().
I traced the problem until const int ac = self->d_func()->argc;
where ac will contain a value greater than 0 ( never the same).
I don't change argc at the application levelI see that argc and self->d_func()->argc have the same adress but I cannot see where argc value changed.
Any idea?Thierry
wrote on 11 Jan 2017, 03:04 last edited by@tmas
do you setargc
by theargc
inmain
?
I remember thatargc
is at least 1. -
@tmas
do you setargc
by theargc
inmain
?
I remember thatargc
is at least 1.@Flotisable Yes, at the first position in argv there should be the name of the executable.
@tmas how do you use your App class? -
wrote on 11 Jan 2017, 08:10 last edited by
From http://doc.qt.io/qt-5/qcoreapplication.html#QCoreApplication
Warning: [...] argc must be greater than zero and argv must contain at least one valid character string.
-
@tmas
do you setargc
by theargc
inmain
?
I remember thatargc
is at least 1.wrote on 11 Jan 2017, 08:32 last edited by m.sue 1 Nov 2017, 08:33This post is deleted!
4/5