-1

So i am watching youtube tutroials and trying to write hello world but i am already failing

Here is an screenshot

enter image description here

Why won't it execute?

Any help would be really welcome (From Belgium so excuse my broken english)

  • Avoid uploading source code and cmdline output as images. Try an explicit output location for the binary (`-o`) i.e `g++ youtube.cpp -o youtube && ./youtube` – Mansoor Jan 31 '22 at 23:13
  • Visual Studio Code can't find the compiled binary since it's by default searching for "a.out" with no path specifiied. Check where g++ is compiling your binary and the name of the binary. – Irelia Jan 31 '22 at 23:13
  • 1
    Youtube is no substitute for [a good book](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list), especially when dealing with a complicated language like C++. Remember that youtube is not an expert-curated site, so bat-smurf crazies are able to post tutorials just like anyone else. Pick and choose your tutorials carefully. A good background in the fundamentals of C++ will help you pick more sucessfully. – user4581301 Jan 31 '22 at 23:18
  • Actually, @Yuumi, he specified "./a.out", which absolutely does include the path. – Tim Roberts Jan 31 '22 at 23:18
  • Additional handy reading: [Why not upload images of code/errors when asking a question?](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question). You can get more information by taking the [tour] and reading [ask]. – user4581301 Jan 31 '22 at 23:19
  • My advice is to try this Microsoft tutorial before you continue: [https://code.visualstudio.com/docs/cpp/config-mingw](https://code.visualstudio.com/docs/cpp/config-mingw) – drescherjm Jan 31 '22 at 23:31
  • I tried to debug your program, but my IDE doesn't know how to extract code from an image. No code posted as text == no help. – Thomas Matthews Feb 01 '22 at 01:16
  • i have some books about coding, yet i find videos more pleasing for me to learn from videos. I use more then one source of teacher on the internet – benedict Cherlet Feb 12 '22 at 17:35
  • anyway ill check out the information u all posted, thank you – benedict Cherlet Feb 12 '22 at 17:36

1 Answers1

4

You're on Windows. Instead of a.out, the default name for gcc is a.exe. You can see that in the directory listing on the left.

Tim Roberts
  • 48,973
  • 4
  • 21
  • 30
  • HAVING SAID THAT, the other replies are right. I NEVER let `g++` use the default name. I ALWAYS specify `g++ -o xxx.exe xxx.cpp` so that I control the name. – Tim Roberts Jan 31 '22 at 23:40