Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions week01/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ int mul(int a, int b)
return n1 * n2
}
```
The compilation error messages generated by the prevous source code.
The compilation error messages generated by the previous source code.
```console
$ g++ -c mul.cpp
mul.cpp:5:12: error: use of undeclared identifier 'n1'
Expand All @@ -206,7 +206,7 @@ mul.cpp:5:19: error: expected ';' after return statement
3 errors generated.
```

If there are compilation errors, it is better to check the source code to make sure all spells are correct, no `;` or `(` missing. For peole in East Asia, they should also be very careful with characters like `;`, `)`, etc. They are different from `;` and `)`. Another Chinese character ` ` which is a wider space is easy to be miss used with the normal space.
If there are compilation errors, it is better to check the source code to make sure all spells are correct, no `;` or `(` missing. For people in East Asia, they should also be very careful with characters like `;`, `)`, etc. They are different from `;` and `)`. Another Chinese character ` ` which is a wider space is easy to be miss used with the normal space.

### Link Errors

Expand All @@ -215,12 +215,12 @@ Link errors are caused in the link stage. The most common link error is `undefin
//mul.cpp
#include "mul.hpp"

int Mul(int a, int b) //mul() is callled in main() but here it is Mul()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here function name should be 'mul' as in the main it is mentioned it is mul()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and this is the example showing link error due to a function name typo. I just fixed the typo "callled" to "called".

int Mul(int a, int b) //mul() is called in main() but here it is Mul()
{
return a * b;
}
```
You will get a link error as follows even you can comile the two files `main.cpp` and `mul.cpp` separately.
You will get a link error as follows even you can compile the two files `main.cpp` and `mul.cpp` separately.
```console
$ g++ main.o mul.o -o mul
Undefined symbols for architecture arm64:
Expand Down