Solved How to share command line argument?
-
Hi.
I've only been using C++ for a short time.
How can I use the command line arguments in another cpp file?
I thought of a way to use a global variable, but I hear that global variables should be avoided.
Is there any other way than global variables? -
-
-
This post is deleted! -
@jsulm
Does it matter if I use it outside of the main function? -
@Knj-Tkm said in How to share command line argument?:
Does it matter if I use it outside of the main function?
No, why should it?
It will work after app (QApplication) instance was created:QApplication a(argc, argv);
qApp is a macro which can be used everywhere in your application.
-
@jsulm
OK, Thanks!