Skip to content

Commit 1109f30

Browse files
authored
Merge pull request #5 from ese-msc/tmd_update2025
updates for 2025-6
2 parents f51313d + 581bfae commit 1109f30

File tree

2 files changed

+31
-37
lines changed

2 files changed

+31
-37
lines changed

part_one/01_running.md

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,22 @@ Whereas Python is mostly fairly simple to get working with straight away, especi
1010

1111
There are a variety of platforms which will allow you to run small one file C & C++ programs or code snippets directly from your browser. A (non-exhaustive) list of examples includes:
1212
- [Replit](https://replit.com/languages/cpp)
13-
- [Codepad](https://codepad.org/)
13+
- [Codepad](https://codepad.app/)
1414
- [Ideone](https://ideone.com/)
1515

1616
![](images/replit.jpeg)
1717

1818
On each of these platforms you can cut & paste code from the examples in this primer, and then run the code to generate output, usually with a single click of the mouse on the button labelled `Run`. Note that not all platforms will let you interact with your code while it runs (Replit will, as well as linking to your GitHub account if you'd like to save your work).
1919

20-
## Visual Studio Code & Devcontainers
21-
```{index} compiling: via docker
22-
```
23-
24-
A more local option is to take advantage of the combined power of Docker and Visual Studio Code to provide files which again you can often compile with one click.
25-
26-
![](images/vscode.png)
27-
28-
To begin, fork the accompanying [examples repository](https://github.com/ese-msc/c-examples) and download it, then with Docker desktop running, open your local repository in VS code. You will be presented with a query banner "Folder contains a Dev Container configuration file. Reopen folder to develop in a container (learn more).". Select "Reopen in Container". This will restart the VS Code editor window, while connecting to a Docker container build from the repository [C examples Dockerfile](https://ese-msc/c-examples/.devcontainer/Dockerfile). This container has `git` and `Python` installed, together a working linux C++ compiler (the GNU compiler) and some useful VS Code extensions installed.
29-
30-
For simple, non-interactive C++ programmes contained in a single file, you can now build & run them with the Run Code button (ctrl+alt+N). For interactive files, you will need to run the program yourself using (for a file `hello.cpp` in the current directory) a command like:
31-
32-
```
33-
g++ -o hello hello.cpp
34-
./hello
35-
```
36-
37-
Here `g++` is the name of the linux GNU C++ compiler, the `-o` option specifies the name of the output executable file (the default is `a.out`) and we must list the `.cpp` source file to compile into it. The second line then runs our new executable.
38-
3920
## Compiling natively
21+
A more long-term solution, and what you will be using during the Advanced Programming module, is to use a local compiler on your computer. There are many options out there, which depend on which operating system you are using. The following are some popular options available to you.
4022

41-
### Windows: Visual Studio
42-
```{index} compiling:windows native
43-
```
44-
45-
For Windows users only, you can obtain the Microsoft C/C++ compiler by downloading the Visual Studio community package [here](https://visualstudio.microsoft.com/vs/community/). Visual Studio is a sister package to Visual Studio Code, which combines build tools for several programming languages along with an Integrating Development Environment (IDE) to code them in.
23+
```{important} In the **Advanced Programming** module in 2025-26, we will be using the following IDE and compiler combination:
24+
- VS Code
25+
- `gcc` version 15
4626
47-
To compile a file, we must create a matching Visual Studio solution file. For a one line program, the easiest way to do this is to start from the `console application` template project, and modify the default file appropriately. We can then compile and run our source using the `Local Windows Debugger` play button, or the `Debug>Start Debugging (F5)` menu option.
27+
Please see below for how to install this combination on the relevant operating system for your laptop.
28+
```
4829

4930
### Apple Macs: `gcc` or `clang`
5031
```{index} compiling:mac
@@ -62,29 +43,29 @@ Most Mac users on the course will already have Homebrew installed, but for those
6243
brew install gcc
6344
```
6445

65-
will install a recent version of `gcc` (version 14 as of early December 2024) as well as placing it in your standard path. Once installed, (and having opened a new terminal) you can confirm that things work by running the following command in a terminal
46+
will install a recent version of `gcc` (version 15 as of early December 2025) as well as placing it in your standard path. Once installed, (and having opened a new terminal) you can confirm that things work by running the following command in a terminal
6647

6748
```
68-
gcc-14 --version
49+
gcc-15 --version
6950
```
7051

7152
You should see a response something like
7253

7354
```
74-
gcc-14 (Homebrew GCC 14.2.0) 13.4.0
75-
Copyright (C) 2024 Free Software Foundation, Inc.
55+
gcc-15 (Homebrew GCC 15.2.0) 15.2.0
56+
Copyright (C) 2025 Free Software Foundation, Inc.
7657
This is free software; see the source for copying conditions. There is NO
7758
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7859
```
7960

8061
To compile a C++ file called `hello.cpp` into an exectuable called `hello`, then run it, use a command like
8162

8263
```
83-
g++-14 -o hello hello.cpp
64+
g++-15 -o hello hello.cpp
8465
./hello
8566
```
8667

87-
Here `g++-14` is the name of your new GNU C++ compiler (specifically, version number 14), the `-o` option specifies the name of the output file (the default is `a.out`) and we must list the `.cpp` source file to compile into it. The second line then runs our new executable file which we have just compiled.
68+
Here `g++-15` is the name of your new GNU C++ compiler (specifically, version number 14), the `-o` option specifies the name of the output file (the default is `a.out`) and we must list the `.cpp` source file to compile into it. The second line then runs our new executable file which we have just compiled.
8869

8970
Remember, we only need to compile once, and then we can run the executable as many times as we like. If we make any changes to the source code, we must recompile before we can run the new version and see the results.
9071

@@ -101,8 +82,8 @@ cc --version
10182
You should see a response something like
10283

10384
```
104-
Apple clang version 19.1.4 (clang-1900.1.4.202)
105-
Target: arm64-apple-darwin21.6.0
85+
Apple clang version 17.0.0 (clang-1700.4.4.1)
86+
Target: arm64-apple-darwin24.6.0
10687
Thread model: posix
10788
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
10889
```
@@ -137,8 +118,8 @@ gcc --version
137118
You should see a response something like
138119

139120
```
140-
gcc (Ubuntu 11.4.0-1unintu1~22.04) 11.4.0
141-
Copyright (C) 2021 Free Software Foundation, Inc.
121+
gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
122+
Copyright (C) 2023 Free Software Foundation, Inc.
142123
This is free software; see the source for copying conditions. There is NO
143124
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
144125
```
@@ -152,6 +133,19 @@ g++ -o hello hello.cpp
152133

153134
Here `g++` is the name of your new GNU C++ compiler, the `-o` option specifies the name of the output file (the default is `a.out`) and we must list the `.cpp` source file to compile into it. The second line then runs our new executable.
154135

136+
137+
### Windows: Visual Studio
138+
```{index} compiling:windows native
139+
```
140+
141+
For Windows users only, you can also obtain the Microsoft C/C++ compiler (MSVC) by downloading the Visual Studio community package [here](https://visualstudio.microsoft.com/vs/community/). Visual Studio is a sister package to Visual Studio Code, which combines build tools for several programming languages along with an Integrating Development Environment (IDE) to code them in.
142+
143+
To compile a file, we must create a matching Visual Studio solution file. For a one line program, the easiest way to do this is to start from the `console application` template project, and modify the default file appropriately. We can then compile and run our source using the `Local Windows Debugger` play button, or the `Debug>Start Debugging (F5)` menu option.
144+
145+
```{note}
146+
While MSVC and Visual Studio are a powerful combo, we will not be using them much in the Advanced Programming module. For those of you who go on to study Patterns for Parallel Programming (ACSE), you will likely see this IDE/compiler combination in more detail.
147+
```
148+
155149
## Summary
156150

157151
You should now have found a method to compile C/C++ programs which works for you. It is fine to use either of the first two options for the duration of this primer, but you will find a local compiler much more use during the actual Advanced Programming course.

part_one/03_simple_math.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ int main(void){
122122
y[i] = y[i-1] + h*f(y[i-1]);
123123
}
124124

125-
for (int i=0; i<n; i++) {
125+
for (int i=0; i<=nsteps; i++) {
126126
std::cout << t[i] << " " << y[i] << std::endl;
127127
}
128128

0 commit comments

Comments
 (0)