Wednesday

Simple Qt Console Application

  • Click Start Menu > All Programs > Qt SDK > Qt Creator to open Qt 4 C++ Editor.
  • On Qt Creator, click Menubar > File > New File or Project... Ctrl+N to create a new project.
  • At LHS panel, Choose a template: Other Project. At RHS panel, click Qt Console Application. Click "Choose..." button to create a project containing a single main.cpp file with a stub implementation.
  • Give the file a name as "cpp_simple_hello_world". Create in: D:\ws_qt. Click Next button to continue.
  • Uncheck "Qt 4.7.3  for Desktop - MSVC2008 (Qt SDK) debug" and "Qt 4.7.3  for Desktop - MSVC2008 (Qt SDK) release" if there is any. Click Next button to continue.
  • Click Finish.
  • In the main.cpp file, enter the following source code for the file content.
---------|---------|---------|---------|
#include <QtCore/QCoreApplication>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    cout << "Hello, World!" << endl;

    return a.exec();
}
---------|---------|---------|---------|
  • Ctrl+R to run the Qt (cute, cutie, Q.T. pronunciation) console application.

No comments:

Measure execution time with Julia, example using sorting algorithms

# random integers between 1 and 100 inclusive, generate thousands of them x = rand ( 1 : 100 , 100000 ) @time sort (x; alg=InsertionSort, r...