https://github.com/evgenyneu/cpp_hello_world
An example showing how to write, compile and run a C++ program.
https://github.com/evgenyneu/cpp_hello_world
Last synced: about 2 months ago
JSON representation
An example showing how to write, compile and run a C++ program.
- Host: GitHub
- URL: https://github.com/evgenyneu/cpp_hello_world
- Owner: evgenyneu
- Created: 2019-01-01T04:16:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-01T04:32:21.000Z (over 6 years ago)
- Last Synced: 2025-01-10T14:41:42.988Z (3 months ago)
- Language: Makefile
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A simple C++ program
This example shows how to write and build a simple C++ program that adds two numbers.
The program contains of the main file `hello.cpp` that includes an `add` function coded in `add.cpp` and `add.h` files. The `makefile` file includes instruction for compiling the source code into an executable file called `hello`.
## Install source code
```
git clone https://github.com/evgenyneu/cpp_hello_world.git
```## Change directory
```
cd cpp_hello_world
```## Compile
```
make
```## Run
```
./hello
```## Cleaning
Remove the *.o files:
```
make clean
```Remove everything except the source files. It removes the *.o files, .depend file and the executable:
```
make distclean
```## Credits
* The code is based on [this article](https://www.learncpp.com/cpp-tutorial/19-header-files/).
* The makefile is based on this [stackoverflow answer](https://stackoverflow.com/a/2481326/297131).