README: Fix the order of sources/libraries in example compilation commands.
Some linkers (among them, the GNU ld 2.28 on my laptop, which clang relies on for linking) are picky about the order they get their ingredients in on the command line. When they are, they want the leaf nodes (like your `main` function) first, and the dependencies (like `libcompiler.a`) after. It's kind of counterintuitive (at least to me) that this is the preferred order, though I can understand it from the perspective of efficient resource use in the era when some linkers were first written. Anyway, it's the way it is. There's a detailed explanation here: https://stackoverflow.com/a/409470/378130 So, adjust the examples in the README to an order that should work everywhere. This fixes part of #102.
This commit is contained in:
parent
168d3ddb33
commit
276ca6ab8a
1 changed files with 2 additions and 2 deletions
|
|
@ -137,8 +137,8 @@ To create the parser, compile this file like this:
|
|||
clang++ -std=c++11 \
|
||||
-I tree-sitter/include \
|
||||
-L tree-sitter/out/Release \
|
||||
-l compiler \
|
||||
arithmetic_grammar.cc \
|
||||
-l compiler \
|
||||
-o arithmetic_grammar
|
||||
```
|
||||
|
||||
|
|
@ -209,8 +209,8 @@ To demo this parser's capabilities, compile this program like this:
|
|||
clang \
|
||||
-I tree-sitter/include \
|
||||
-L tree-sitter/out/Debug \
|
||||
test_parser.c arithmetic_parser.c \
|
||||
-l runtime \
|
||||
arithmetic_parser.c test_parser.c \
|
||||
-o test_parser
|
||||
|
||||
./test_parser
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue