Re: Example use namespace
In this simple example You don't need a QCoreApplication instance. Just remove lines 10 and 15.
Re: Example use namespace
Hi Lesiok, then I have to write code that is
Code:
#include <QCoreApplication>
#include <iostream>
#include "geometria.h"
using namespace std;
using namespace Geometria;
int main(int argc, char *argv[])
{
float ris = Norma(3);
cout << "Il risultato è: " << ris << endl;
return 0;
}
However, doing so by booting from dos shell prompt does not display anything I.
how do I do?
Added after 51 minutes:
The really strange thing is that using the following code to main.cpp (geometria.h and leaving unchanged):
Code:
#include <QCoreApplication>
#include <iostream>
#include "geometria.h"
using namespace std;
using namespace Geometria;
int main(int argc, char *argv[])
{
float ris = Norma(3);
cout << "Il valore e': " << ris << endl;
return a.exec();
}
using the wizard to create a console project in Qt, so it works perfectly, but if I create a project wizard to empty and fill it with files main.cpp and geometria.h seen above does not work, in the sense that it makes me see nothing in the dos shell prompt.
Another thing I never understood is why the projects console shell prompt dos never close yourself but you have to do CTRL-C to terminate.
Can anyone give me the answers to that?
Re: Example use namespace
a.exec() puts your program to a event loop, so if you dont want this you must remove return a.exec() and put return 0; instead.
Re: Example use namespace
thanks Ali Reza ;) Now is the perfect