Answers for "run a cpp file from cmd"

C++
0

how to run cpp file

# Open Terminal: 

# Type: 
g++ --version

# If the command is not recognized: 
sudo apt-get install g++ 
g++ --version # should work now 

# If the command is recognized
mkdir tmp 
cd tmp 
touch main.cpp 
# open main.cpp using vi, vim, gedit, etc
# Type in a hello world program: 
# https://www.tutorialspoint.com/cplusplus-hello-world-program

# Once this has been done, type in: 
g++ main.cpp
./a.out
Posted by: Guest on August-31-2021
0

c++ compile to exe command line

gcc sourcefile_name.c -o outputfile.exe
Posted by: Guest on October-03-2020

Browse Popular Code Answers by Language