lunduniversity.lu.se

Computer Science

Faculty of Engineering, LTH

Denna sida på svenska This page in English

Computer Labs

Four compulsory computer labs during week 3, 4, 5, 6 of study period 3.  You are expected to solve the lab assignments on your own (contact a teacher if you need help).

The schedule for the labs is in the course plan. 

Sign up for the labs at sam.cs.lth.se/Labs, groups of two people.

The labs will be published during the first week.

Sign-up for the labs will open on thursday.

Files for the labs (see the lab assignments for download instructions):

Lab About Files Notes 
Basic C++ Programming lab1.tar.gz    
Introduction to the Standard Librarylab2.tar.gz
Strings and Streamslab3.tar.gz
Standard Containers and Algorithmslab4.tar.gz

Notes, corrections and additions

6/2: The file words can be found in /usr/share/dict/words on the lab computers (and most Linuxes). If it is missing on your computer you can either copy it from there, or download it here.

1/2:  If you do the labs on a Mac with the standard XCode development tools, you need to be aware that Apple uses llvm, so the commands gcc and g++ are aliases for clang and clang++. This is not obvious, as clang and gcc are command-line compatible, so what is written about g++ also applies to clang++.
For the debugger, on the other hand, they are different. lldb, which is the llvm debugger, has a different set of commands than gdb, so the instructions in lab1 do not apply. For an introduction to lldb, see https://lldb.llvm.org/tutorial.html.
Apple has a table of equivalent gdb/llvm commands.
It is possible to install gdb on a mac, for instance with MacPorts or HomeBrew, but note that the program needs to be signed, which may be a bit tricky the first time.

31/1:  in lab1, A3, the MakefileWithDeps includes rules for building all the programs, including the later assignments. If you make all using this makefile, it will give the error
test_coding.cc:2:20: fatal error: coding.h: No such file or director

To fix that, before doing the coding assignment, either remove test_coding from PROGS, or do specific make calls, like make hello and make ltest

25/1:  uploaded a new version of the assignments pdf file with a small addition to lab1, section 7.1, A8, on how to add a Makefile rule for building liblab1.a.

  •  Note that this does not tell make how to create liblab1.a. For that, add a rule

      liblab1.a: coding.o list.o
          ar crv liblab1.a coding.o list.o

  •  Note that you cannot easily write rules to make the programs depend on  the lib, so you must first make liblab1.a and then make. See section 8 for how CMake handles this.

Doing the labs under Windows

The lab instructions are written for a Linux system, but they can be run on Windows 10 under the Windows subsystem for linux (WSL). The web page for EDAF30 contains instructions for setting up a suitable environment under Windows 10 (in swedish). The instructions assume that WSL is activated.