Saturday

How to write a console application in C++ with Qt Creator?

Open Qt Creator.
Choose Menu > File > New File or Project.
Choose a template: Other Project > Qt Console Application.
Click Choose button to choose Qt Console Application.
Name the Qt Console Application project as qt_console_app_prj1.
Create the console application in D:\code_qt_folder path. Tick the box to use this path as default project location.
Click Next button.
Make sure Qt 4.7.3 for Desktop MinGW 4.4 (Qt SDK) debug and release boxes are ticked.
Click Next button.
Click Finish button.

Replace the entire main.cpp content with the following code:
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main(int argc, char *argv[])
{
    //Ctrl+/ = toggle between comment and uncomment selection

    string name;
    cout << "Enter your name: ";
    cin >> name; //World
    cout << "Hello, " << name << "!" << endl;

    system("pause");
    return 0;
}

Press Ctrl+S to save this file first.

Press Ctrl+R to run this file to get the Qt Console Application.

Notes:
You must create a project to run cpp files.

Friday

How to install and run Qt C++ in Windows?

Download Qt SDK v1.1.2 (Qt_SDK_Win_offline_v1_1_2_en.exe) from
http://www.developer.nokia.com/Resources/Tools_and_downloads/.

Do not download Qt Libraries, Qt Creator or MinGW v4.4.0. If not, you have to download and install more than one time. Qt SDK contains qt libraries, qt creator ide, and mingw C++ compiler in one installation package.

After the download is finished, click the executable file to install.

Select "Custom" and not default as the type of installation. Tick the box to remove old Qt creator settings.

Select the following components to install:
[tick] Qt SDK > APIs
[tick] Qt SDK > Documentation
[tick] Miscellaneous > Qt Examples
[tick] Miscellaneous > MinGW 4.4
[tick] Development Tools > Qt Assistant
[tick] Development Tools > Qt Designer
[tick] Development Tools > Desktop Qt > Qt 4.7.3 > Desktop Qt 4.7.3 - MINGW
[tick] Development Tools > Qt Linguist
[ticked by default] Qt Creator
[tick] Development Tools > Simulator > Simulator fonts
[tick] Development Tools > Simulator > Simulator Qt 4.7.3 – MinGW 4.4

Wait until the installation is complete.

After the installation has been completed, set the Qt paths (environment variables) in Windows by removing the string "C:\Program Files\CodeBlocks\MinGW\bin" if there is any and then replace it with the string of two paths "C:\QtSDK\Desktop\Qt\4.7.3\mingw\bin;C:\QtSDK\mingw\bin".

Copy all *.dll files from “C:\QtSDK\Desktop\Qt\4.7.3\mingw\bin” to “C:\Windows\System32”.

Open Qt Creator IDE.

Create a new Qt Widget Project. Choose Qt Gui Application to create an application for the desktop.

Tick to use the path at “x:\code_qt_folder” as your default project location.

Make sure “Use Shadow Building”, Qt 4.7.3 for Desktop – MinGW 4.4 (Qt SDK) debug and release boxes are ticked.

Press Ctrl + R to run the project.

Wait until the project finish building to see your running program.

If a hater attacked your age and not the goodness of you

Whether young or old, I've always been known what endures. I've known the very idea of people that were all created equal and deserv...