Define global var that is type of QScriptEngine throws exception
in common.h i declare global var as
- extern QScriptEngine engine;
in main.cpp, i define it as
when i start application, it throws Excetpion:
this application has requested the Runtime to terminate it in an unusual way.
please contact the application’s support team for more information.
return code 3
Any idea what I can do?
Thanks a lot.
Edit: Fixed code tags. Please wrap with @; mlong
You cannot create a script engine (and many other Qt objects) as long as you haven’t created a Q(Core)Application.
Passing the script engine as a global variable is a very questionable design decision. A better choice would be subclassing QApplication and adding it as a member or storing it as a property of QApplication (the QApplication instance is accessible from anywhere using qApp() or QCoreApplication::instance()).