[SOLVED] Unable to run OSX code



  • Greetings!

    I'm trying to run my first program on QT below and it will not run I get the below output. Need Help!

    #include <QCoreApplication>
    #include <iostream>

    using namespace std;

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);
    cout << "tesT";
    return a.exec();
    }
    Application OUTPUT: Starting /MultimediaOSX/QT/build-LoTQT-Desktop_Qt_5_4_2_clang_64bit-Debug/LoTQT... (it just sits here)

    Terminal OUTPUT: Last login: Wed Jun 17 11:28:13 on ttys000
    JiMac:~ co$ cd /; /MultimediaOSX/QT/Qt\ Creator.app/Contents/MacOS/../Resources/qtcreator_process_stub run /var/folders/fw/lqq81zbd2fnbycx75mq4_gvm0000gn/T/QtCreator.N12263/stub-socket Press\ <RETURN>\ to\ close\ this\ window... /MultimediaOSX/QT/build-LoTQT-Desktop_Qt_5_4_2_clang_64bit-Debug /var/folders/fw/lqq81zbd2fnbycx75mq4_gvm0000gn/T/QtCreator.t12263 12263 /MultimediaOSX/QT/build-LoTQT-Desktop_Qt_5_4_2_clang_64bit-Debug/LoTQT


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    It's behaving as expected. a.exec() starts the event loop, but since you are doing nothing, it will run forever until you kill the application.



  • Thanks for the response!

    Why is it not displaying the below line of code?

    cout << "tesT";

    Thanks for your help,

    Duncan



  • HI and welcome to devnet,

    cout is a buffered stream; it doesn't print the stream until you don't flush (endl flushes)

    try with cout << "Test" << endl;



  • Thanks for the help all, Im a noob and realized im working in an IDE like Xcode that makes apps.

    I followed this tutorial for good info:

    https://www.youtube.com/watch?v=6KtOzh0StTc

    Thanks again!!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.