Skip to content

Commit

Permalink
C++ setup files and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanisho committed Apr 25, 2024
1 parent fb0d8a1 commit cbc7d92
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/setup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Running C++20 Code with GCC

This guide outlines the steps to compile and run C++20 code using the GNU Compiler Collection (GCC). It is intended for those who want to work with modern C++ features. More specifcially, it is important that we use a consistent version of C++ throughout the entirety of this project to ensure consistency.

Flag
```bash
-std=c++20
```
should be used on all g++ compilation commands.

## Prerequisites
Before running C++20 code, ensure you have the following:
- GCC installed (Version 10 or later for C++20 support)
- Basic understanding of C++ programming
- A terminal or command-line environment

## Compiling C++20 Code
To compile a C++20 program, use the following command in your terminal or command line:

```bash
g++ -std=c++20 <source-file> -o <output-file>
```

## Example
Here's an example to compile a C++20 program, main.cpp, into an executable called my_program:

```bash
g++ -std=c++20 main.cpp -o my_program
```

## Running the program
To run the compiled executable, use the following command:
```bash
./my_program
```
This will execute the compiled code and display the output in your terminal or command-line environment.
Binary file added tests/setup/version
Binary file not shown.
13 changes: 13 additions & 0 deletions tests/setup/version.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <iostream>
#include <ranges>

// test program to ensure successfull c++ 20 setup and gcc setup
int main()
{
std::vector<int> numbers = {1, 2, 3, 4, 5};
for (int i = 0; i < numbers.size(); i++)
{
std::cout << numbers[i] << " ";
}
return 0;
}

0 comments on commit cbc7d92

Please sign in to comment.