unknown probelm

I recently replaced my hard drives and install win 10 pro. Now, I cannot even run the most simple C++ program on VS code.

For example, run

1
2
3
4
5
6
7
8
#include <iostream>

int main()
{
    std::cout << "something" << "\n" ; 


}


I get

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS D:\Programming\ML\DSFS\visualization> g++ test.cpp
test.cpp: In function 'int main()':
test.cpp:5:10: error: 'cout' is not a member of 'std'
std::cout << "something" << "\n" ;
^~~~
test.cpp:5:10: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
test.cpp:2:1:
+#include <iostream>

test.cpp:5:10:
std::cout << "something" << "\n" ;
^~~~

Please help, thanks in advance.
Last edited on
VSC is either damaged (reinstall or repair) or configured wrong (paths?) in some way.
Is this a new installation?
don't know if this is still a problem, as its a very old post, but recent comments say it was never fixed.

https://stackoverflow.com/questions/44094817/why-is-visual-studio-code-telling-me-that-cout-is-not-a-member-of-std-namespace
Last edited on
@jonnin

Yes, this is a new installation. None of the methods mentioned in the post worked for me.
Thanks though.
Topic archived. No new replies allowed.