Qt

hello, world!


main.cpp

#include <QApplication>
#include <QWidget>
#include <QLabel>

int main(int argc, char** argv)
{
  QApplication app(argc, argv);
  QWidget *win;
  QLabel *label;

  win = new QWidget;
  label = new QLabel("Hello, world!", win);
  win->show();
  return app.exec();
}

main.pro

TARGET = main
SOURCES = main.cpp

編譯、執行

$ qmake
$ make
$ ./main


返回上一頁