0

error

#include<iostream>
using namespace std;
int main()
{
    cout <<"sup";
    return 0;
}    

I have been using turbo c + + till now and I have done everything in my knowledge but it is not helping. I use mingw compiler

Ch3steR
  • 20,090
  • 4
  • 28
  • 58
Amal
  • 1
  • 1
  • Unrelated, but you may want to read [Why is "using namespace std;" considered bad practice?](https://stackoverflow.com/q/1452721/11082165). – Brian61354270 Dec 04 '21 at 16:43
  • You're compiling using `gcc` (the C compiler). You want to use `g++` (the C++ compiler). – Brian61354270 Dec 04 '21 at 16:44
  • I have tried the g++ and all the errors are gone but still no output cout keyword is in white colour (should be in blue i think) – Amal Dec 04 '21 at 16:49
  • `std::cout` is just a global (namespace level) variable. It's not a keyword. – Brian61354270 Dec 04 '21 at 16:50
  • @Amal `g++ test.cpp` only compiles the code and generates `a.out` executable run that executable. Since you're using windows I guess you'd get `a.exe`. – Ch3steR Dec 04 '21 at 16:52
  • yeah its done THANK YOU, but why is it "a.exe" why not test.exe thanks – Amal Dec 04 '21 at 17:03
  • @Amal That's just the default name GCC picks if you don't specify one yourself. You can specify an output name with the `-o` flag, e.g. `g++ test.cpp -o test.exe`. – Brian61354270 Dec 04 '21 at 17:26
  • Also, if you're just getting started with C++, it's highly recommended that you [enable compiler warnings](https://stackoverflow.com/q/5088460/11082165). For manually compilation, a good basic set of warning flags is `-Wall -Wextra -pedantic -Wconversion`. – Brian61354270 Dec 04 '21 at 17:29

0 Answers0