Hey everyone, I'm new to programming and I'm having some trouble with my first C++ program. I ran the command `g++ -o code day2.cpp` in the terminal, and it showed no errors, but I don't see any output in the output area. When I tried running it with `./day2.exe`, it executed and printed on the terminal. Can someone explain what's going on? I'm really confused about this!
1 Answer
It sounds like you have a common misunderstanding about the compilation and execution process. When you use `g++ -o code day2.cpp`, you're only compiling your program. This step converts your source code into an executable file, and you're not supposed to see any output at this stage if there are no errors. It's only when you run the program with `./day2.exe` that you'll actually see the output you expect, as that's when your code is executed.
Related Questions
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically
[Centos] Delete All Files And Folders That Contain a String