Results 1 to 10 of 10

Thread: QtCreator - Plain C++ Project Hello World only runs without "endl"

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Question QtCreator - Plain C++ Project Hello World only runs without "endl"

    Hi all,

    I have installed Qt 5.0.1 with QtCreator 2.6.2 on Windows 7 and experience a strange behaviour. When I start a new plain C project, everything works fine (the standard Hello World is printed to the console). However when I start a new plain C++ project, again the Hello World is printed to the console but a new (native Microsoft) window pops up and tells me that myprogramname.exe doesn't work anymore . And what I really don't get is the fact that if I delete the part "<< endl" everythings run without problems!

    It seems like Qt is having trouble with endl. When I hover endl with my cursor, it says something like "QTextStream & endl...", whereas hovering cout results in "std::cout". Is this perhaps my problem? Can you replicate my problem on your PC? What can I do to fix this problem?

    main.cpp
    Qt Code:
    1. #include <iostream>
    2.  
    3. using namespace std;
    4.  
    5. int main()
    6. {
    7. cout << "Hello World!" << endl;
    8. return 0;
    9. }
    To copy to clipboard, switch view to plain text mode 

    myprogramname.pro
    Qt Code:
    1. TEMPLATE = app
    2. CONFIG += console
    3. CONFIG -= app_bundle
    4. CONFIG -= qt
    5.  
    6. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: QtCreator - Plain C++ Project Hello World only runs without "endl"

    clean and rebuild.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3

    Default Re: QtCreator - Plain C++ Project Hello World only runs without "endl"

    Clean and rebuild does not work. It even happens if I start a completely new plain C++ Project and just run it..

Similar Threads

  1. Why this doesn't work? qDebug() << "Test" << std::endl;
    By grayfox in forum Qt Programming
    Replies: 4
    Last Post: 1st June 2011, 10:19
  2. Replies: 3
    Last Post: 15th February 2010, 17:27
  3. Replies: 3
    Last Post: 8th July 2008, 19:37
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. Setting up qmake to run "Hello World"
    By Rolsch in forum Newbie
    Replies: 2
    Last Post: 27th May 2006, 02:37

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.