Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. no member named 'cout' in namespace 'std'
QtWS25 Last Chance

no member named 'cout' in namespace 'std'

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 7 Posters 8.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thomas9258
    wrote on 2 Sept 2020, 11:41 last edited by Thomas9258 9 Feb 2020, 12:56
    #1

    ive made a simple hello world script:

    #include <QCoreApplication>
    #include <iostream>
    
    int main()
    {   
        std::cout << "hello world" <<std::endl;
        return 0;
    }
    

    I get an error in the editor, and not when running the script. the thing is, i dont get why the editor tells me something is wrong, and i dont really know how to fix it, maybe someone else have runned into the same issue?
    cout-error.png
    terminal-output.png

    Edit:
    Thanks everyone for helping me!
    mrjj's solution: Turning off "clang format" in help > About_Plugins seems to work (in hiding every clang notification thus hiding even the incorrect ones). Im fine with the solution though, they arent useful in my opinion anyway.

    P 1 Reply Last reply 2 Sept 2020, 11:52
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 2 Sept 2020, 11:49 last edited by mrjj 9 Feb 2020, 11:49
      #2

      Hi and welcome to the forums.
      Its the clang code model acting up.
      Not seen that for cout before !
      It normally gives hints/advice about the code.

      https://forum.qt.io/topic/100762/qt-creator-clang-code-model-problems-collection

      Im not sure why it cant see into std.. That is new.

      You can "fix" it by disabling the code model ( see link)
      Or just ignore it.

      1 Reply Last reply
      1
      • T Thomas9258
        2 Sept 2020, 11:41

        ive made a simple hello world script:

        #include <QCoreApplication>
        #include <iostream>
        
        int main()
        {   
            std::cout << "hello world" <<std::endl;
            return 0;
        }
        

        I get an error in the editor, and not when running the script. the thing is, i dont get why the editor tells me something is wrong, and i dont really know how to fix it, maybe someone else have runned into the same issue?
        cout-error.png
        terminal-output.png

        Edit:
        Thanks everyone for helping me!
        mrjj's solution: Turning off "clang format" in help > About_Plugins seems to work (in hiding every clang notification thus hiding even the incorrect ones). Im fine with the solution though, they arent useful in my opinion anyway.

        P Offline
        P Offline
        Pl45m4
        wrote on 2 Sept 2020, 11:52 last edited by
        #3

        @Thomas9258

        Sometimes it takes some time for it to recognize everything. Try a re-build


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        1 Reply Last reply
        1
        • S Offline
          S Offline
          sierdzio
          Moderators
          wrote on 2 Sept 2020, 11:54 last edited by
          #4

          I've noticed this on my side, too, at least since Qt Creator 4.13 (and I think it did sporadically happen in 4.12.x, too).

          I don't have a workaround. It sometimes works, sometimes it does not.

          (Z(:^

          1 Reply Last reply
          2
          • K Offline
            K Offline
            Kopilov
            wrote on 30 Sept 2020, 12:55 last edited by
            #5

            I had the same problem. This helped:
            https://askubuntu.com/questions/1232969/qtcreator-not-recognizing-linked-libraries-after-upgrading-ubuntu-to-20-04
            QtCreator 4.11 still relies on clang-8, but on Ubuntu 20.04 apt will install clang-10. Install clang 8

            sudo apt install clang-8
            
            J S 2 Replies Last reply 30 Sept 2020, 14:02
            2
            • K Kopilov
              30 Sept 2020, 12:55

              I had the same problem. This helped:
              https://askubuntu.com/questions/1232969/qtcreator-not-recognizing-linked-libraries-after-upgrading-ubuntu-to-20-04
              QtCreator 4.11 still relies on clang-8, but on Ubuntu 20.04 apt will install clang-10. Install clang 8

              sudo apt install clang-8
              
              J Offline
              J Offline
              JonB
              wrote on 30 Sept 2020, 14:02 last edited by
              #6

              @Kopilov
              FWIW, just to confirm to any other readers that I had to do this when I moved to Ubuntu 20.04, it is indeed required.

              1 Reply Last reply
              1
              • K Kopilov
                30 Sept 2020, 12:55

                I had the same problem. This helped:
                https://askubuntu.com/questions/1232969/qtcreator-not-recognizing-linked-libraries-after-upgrading-ubuntu-to-20-04
                QtCreator 4.11 still relies on clang-8, but on Ubuntu 20.04 apt will install clang-10. Install clang 8

                sudo apt install clang-8
                
                S Offline
                S Offline
                Skazik
                wrote on 5 Sept 2023, 18:28 last edited by
                #7

                @Kopilov Thank you!! Worked for me fine

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved