Gcc not working in cmd

can someone please help me with this error?
thankyou!

I think you are doing wrong it’s g++ for cpp files and gcc is for c files
try g++ c++_test.cpp

2 Likes

ive tried that too but then it is not even responding with anything :frowning:

Have you added g++ to your path?

actually it was working fine till yesterday,
suddenly today it has stopped working
i’ve added mingw/bin to the the path (maybe one year ago or so)
i didnt make any changes and suddenly it has stopped working today

Could you give me your code so that , I can try to figure this out or try uninstalling your c++ compiler and install it from here CPP Compiler no path setup it will automatically do it for you . Just download it ,install it and you are good to go.

#include<bits/stdc++.h>
using namespace std;

int main()
{
cout<<“hello”;

return 0;

}

this is the code
i will download the compiler again and try.
thankyou :slight_smile:

Your code is quite complex to understand :joy: seems like there is something wrong with your compiler

:joy: :joy:
i will reinstall it.

❯ cat c++_test.cpp
#include<bits/stdc++.h>
using namespace std;

int main()
{
cout<<"hello";

return 0;

}
❯ gcc c++_test.cpp -lstdc++
❯ echo $?
0
❯ ./a.out
hello%

so, it isn’t entirely wrong to use gcc for cpp files :upside_down_face:

1 Like