0

I am trying to learn C++, and following along a YouTube tutorial:

C++ Tutorial for Beginners - C++ in 4 hours - Full Course

Every time I run a simple pre-written hello world code, it keeps giving me an error.

I've uninstalled and re-downloaded CodeBlocks multiple times, as well as XCode through Terminal.

This is my input code:

image

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

This is the error I get in the Terminal:

image

(base) Owner1s-MacBook-Pro:~ owner1$ '/Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/owner1/Documents/c++/hi/bin/Debug/hi '
-bash: /Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/owner1/Documents/c++/hi/bin/Debug/hi : No such file or directory
(base) Owner1s-MacBook-Pro:~ owner1$ 
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • I don't see "no such file or directory" anywhere in your image. Only "process terminated with status 0", which generally means _it worked!_ – Asteroids With Wings Nov 05 '20 at 21:35
  • sorry i just updated it, shouldn't it print hello world in terminal? – Manpreet Mahi Nov 05 '20 at 21:46
  • 2
    If you're "trying to learn C++", you will not learn anything from a random Youtube video. C++ is the most complicated general purpose programming language in use today, and can only be learned effectively [with the help of a good C++ textbook](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list), which should have step by step instructions for using an editor to create a source file, and how to run the compiler, from the terminal prompt, to compile and link a program, without relying on a very complicate GUI IDE that's prone to installation and configuration errors. – Sam Varshavchik Nov 05 '20 at 22:25
  • `/Users/owner1/Documents/c++/hi/bin/Debug/hi : No such file or directory` looks a lot like the program doesn't exist or at least doesn't exist where Code::Blocks expects it to exist. Are you certain that it built? – user4581301 Nov 05 '20 at 22:39
  • Your code is in a source file `main.cpp`. Where is the command that actually compiles that file into an executable `hi`? The error message clearly shows: "*/Users/owner1/Documents/c++/hi/bin/Debug/hi : No such file or directory*" – Remy Lebeau Nov 05 '20 at 22:40

0 Answers0