Installation of Qt Creator (Any version)
I'm a spanish student. I'm asked for programming in the develop environment Qt Creator, but I haven't be able to install a version that works properly. I always find any error. The last one: "Extra characters after test expression".
Could somebody tell me which version (it's better if the compiler is included) should I download to work? I use Windows 7 64 bits.
Thank you in advance.
Hi and welcome to devnet,
The best version is always the latest ;)
More seriously, are you sure your code is clean ? e.g. is it a copy/paste from some other source ? You might have some stray invisible character laying around. In which case you should delete the complete line and write it again by hand.
As per which version to download, if you don't want to install Visual Studio, just use the MinGW Qt package.
Thank you for your quick response.
The last attempt to install Qt Creator I installed the last version available in the Qt Website.
When I introduced (by hand) a "Hello World" program I got this error (“Extra characters after test expression”) for every code line.
Thank you again.
Can you show your code as well as your pro file ?
//Code as an "Empty qt project"
using namespace std;
cout << "Hello World " << endl;
What does c++ code do in your pro file ?
I get no action. Only a message for every code line. The one I mentioned before.
That's normal, the pro file is not the place to write c++ code. Create a new default widget project and you'll see
Yes, I suppose that the code has to be written in the .cpp file and that for each project, a .pro and a .cpp file are automatically created. Aren't they?
My .cpp file is not created.
Did you create a new Qt Widget Application like a suggested ?
Hi dear SGaist :*
astello_, Dear friend follow me in below steps:
- Run Qt Creator
- Click on New project
- Select Qt Widgets Application and press Choose
- Type a name for ur project and click on Next
- In this window select compiler and press Next **Note that if you use from MSVC you should download version of Qt Creator which is compatible with Visual Studio.
- Here just click on Next and after it Finish
- Look left side of Qt Creator and open main.cpp from Source folder
- Add my new code line in main.cpp then Run it
#include <iostream> // Add This Line
using namespace std; // Add This Line
int main(int argc, char *argv)
QApplication a(argc, argv);
cout<<"Hello World :)"<<endl; // Add this line
w.show(); return a.exec();
- After run "Hellow World :)" will print on Application output in bottom of Qt Creator
- say ur experience after u doing it
@ a.jafarabadi Qt Creator can use MSVC or MinGW indifferently. It's Qt's version which must match.
[quote author="SGaist" date="1410293290"]@ a.jafarabadi Qt Creator can use MSVC or MinGW indifferently. It's Qt's version which must match.[/quote]
dear SGaist yes, it's true. we all now always the least version is better :) and the least version have some sub-version which you better now. in that post i want to say if my friend using from visual studio compiler it's good that download Visual studio sub-version of qt
Thank you for your help.
You two are right. If I follow these steps I can do it, but what I need is to open an Empty Qt project.
Here, when I write my code and compile it, it is impossible to run in terminal.
I get the message: "Press return to close this window".
I feel that we are close to the solution but I can't find it.
What do you think?
Thank you again.
What do you mean by run in terminal ?
In any case, running an application outside Qt Creator requires the same step as you would have to do in order to deploy it on another computer.
Run in terminal = Projects (on the left side Menu) -> Run -> Run in terminal marked
What project did you create ?
Empty Qt project
Do you mean a console application ?
New File/project -> Other project -> Empty Qt project. That's what I need.
Then it's not a console application. You asked for an empty project so you have to write everything yourself. What did you write for this project ?
using namespace std;
cout << "Hello" << endl;
In what file did you write that ?
If you want a console application, you need to create a console application project, not an empty project.
File -> New File or Project... -> Applications -> Qt Console Application
After that, you can remove QCoreApplication from main.cpp if you don't want to use Qt classes.
IT WORKS!! Not as I expected in the beginning, but it is useful.
Thank you very much.
if you want develop using native c++ it's better to use from an c++ IDE which is simplest from Qt Creator...
We download, install and use from Qt because of it's useful libraries...
i hope you can find best answer :)