Today, we will be learning on how to run a C++ program directly from compiler.So let's start.
Hit cmd + space and type terminal,

Now, hit enter.
I will be running a simple hello world program named hello.cpp placed on my desktop.
So, first of all change the directory to Desktop.

Now, type g++ <filename.cpp> -o <filename>
and hit enter

If the file is with no errors, it will do nothing otherwise give you details about the error.
Now, type ./<filename> like this and your program will run in the same terminal window.

Otherwise you can check the current directory and find a file named <filename.exec>. Hit enter to run directly.

Thank you for reading. Keep coming for more. Don't forget to like and share ;). Videos in progress.
Hit cmd + space and type terminal,

Now, hit enter.
I will be running a simple hello world program named hello.cpp placed on my desktop.
So, first of all change the directory to Desktop.

Now, type g++ <filename.cpp> -o <filename>
and hit enter

If the file is with no errors, it will do nothing otherwise give you details about the error.
Now, type ./<filename> like this and your program will run in the same terminal window.

Otherwise you can check the current directory and find a file named <filename.exec>. Hit enter to run directly.

Thank you for reading. Keep coming for more. Don't forget to like and share ;). Videos in progress.
Comments
Post a Comment