Difference between revisions of "Qt5/Qt-Creator "Hello World" Console Application"

From dftwiki3
Jump to: navigation, search
(Video)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
--[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 17:04, 1 February 2014 (EST)
 
--[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 17:04, 1 February 2014 (EST)
 
----
 
----
 
+
<br />
 +
<bluebox>
 +
This tutorial illustrates how to create a ''console'' application with Qt-5.  This is slightly different from the approach taken with Qt-4.  The resulting app prints out a "Hello world!" string in the console.  Check [http://cs.smith.edu/dftwiki/index.php/Tutorials this page] for more Qt-related tutorials.
 +
</bluebox>
 +
<br />
 
=Video=
 
=Video=
 
<br />
 
<br />
<center><videoflash>1_aF6o6t-J4</videoflash><center>
+
<center><videoflash>1_aF6o6t-J4</videoflash></center>
 
<br />
 
<br />
 
<br />
 
<br />
Line 12: Line 16:
  
 
=Source Files=
 
=Source Files=
 +
<br /><br />
 +
== Console.pro ==
 +
<br /><br /><source lang="text">
 +
#-------------------------------------------------
 +
#
 +
# Project created by QtCreator 2014-02-01T16:45:38
 +
#
 +
#-------------------------------------------------
 +
 +
QT      += core
 +
 +
QT      -= gui
 +
 +
TARGET = Console
 +
CONFIG  += console
 +
CONFIG  -= app_bundle
 +
 +
TEMPLATE = app
 +
 +
 +
SOURCES += main.cpp
 +
</source><br /><br />
 +
<br /><br />
 +
== main.cpp ==
 +
<br /><br /><source lang="cpp">
 +
#include <QDebug>
 +
 +
int main(int argc, char *argv[]) {
 +
    qDebug() << "hello beautiful world!" << endl << endl;
 +
 +
    return 0;
 +
 +
}
 +
</source><br /><br />
 
<br />
 
<br />
  

Latest revision as of 17:57, 1 February 2014

--D. Thiebaut (talk) 17:04, 1 February 2014 (EST)



This tutorial illustrates how to create a console application with Qt-5. This is slightly different from the approach taken with Qt-4. The resulting app prints out a "Hello world!" string in the console. Check this page for more Qt-related tutorials.


Video







Source Files



Console.pro



#-------------------------------------------------
#
# Project created by QtCreator 2014-02-01T16:45:38
#
#-------------------------------------------------

QT       += core

QT       -= gui

TARGET = Console
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app


SOURCES += main.cpp




main.cpp



#include <QDebug>

int main(int argc, char *argv[]) {
    qDebug() << "hello beautiful world!" << endl << endl;

    return 0;

}