Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved no member named 'cout' in namespace 'std'

    General and Desktop
    7
    7
    5126
    Loading More Posts
    • 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
      Thomas9258 last edited by Thomas9258

      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.

      Pl45m4 1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by mrjj

        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 Reply Quote 1
        • mrjj
          mrjj Lifetime Qt Champion last edited by mrjj

          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 Reply Quote 1
          • Pl45m4
            Pl45m4 @Thomas9258 last edited by

            @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 Reply Quote 1
            • sierdzio
              sierdzio Moderators last edited by

              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 Reply Quote 2
              • K
                Kopilov last edited by

                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
                
                JonB S 2 Replies Last reply Reply Quote 2
                • JonB
                  JonB @Kopilov last edited by

                  @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 Reply Quote 1
                  • S
                    Skazik @Kopilov last edited by

                    @Kopilov Thank you!! Worked for me fine

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post