Results 1 to 3 of 3

Thread: [error]"end" was not declared in this scope

  1. #1
    Join Date
    Mar 2016
    Posts
    1
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Default [error]"end" was not declared in this scope

    I was learning programming from a book, in it there was a program which I have typed out and am recieving an error

    [Error] 'end' was not declared in this scope

    This is the program please tell me what is wrong

    #include<iostream>
    int main()
    {
    int x = 5;
    int y = 7;
    std::cout << endl;
    std::cout << x + y <<""<< x * y;
    std::cout <<end;
    return 0;

    }


    error1.jpg

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: [error]"end" was not declared in this scope

    Your "end" is an "endl" with the "l" missing.

    Cheers,
    _

  3. #3
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    120
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: [error]"end" was not declared in this scope

    Hello,

    don't forget the namespace std. Change lines 6 and 8 to
    Qt Code:
    1. std::cout << std::endl;
    To copy to clipboard, switch view to plain text mode 
    Note: add the missing 'l' to end in line 8 (as anda_skoa already pointed out).

    Best regards
    ars

Similar Threads

  1. QDiaglog, getting the error: ..."was not declared in this scope"
    By juliano.gomes in forum Qt Programming
    Replies: 1
    Last Post: 2nd June 2015, 21:02
  2. Replies: 3
    Last Post: 28th January 2013, 00:53
  3. Replies: 2
    Last Post: 28th February 2010, 08:38
  4. "Treat wchar_t as Built-in Type" to "yes" link error
    By sungaoyong in forum Qt Programming
    Replies: 1
    Last Post: 5th June 2008, 12:45
  5. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 16:58

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.