no member named 'cout' in namespace 'std'
-
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?
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. -
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. -
Sometimes it takes some time for it to recognize everything. Try a re-build
-
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.
-
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 8sudo apt install clang-8