I am trying to run the C files downloaded from here as follows :
gcc main.c docs_file.txt ksg_file.txt
However, I receive the following error:
/usr/bin/ld:docs_file.txt: file format not recognized; treating as linker script
/usr/bin/ld:docs_file.txt:2: syntax error
collect2: ld returned 1 exit status
I am not sure what the problem is.
Update 1:
I get the following errors while compiling:
gcc main.c -o ksg
/tmp/cc4H83rG.o: In function `main':
main.c:(.text+0xa5): undefined reference to `stree_new_tree'
main.c:(.text+0xe0): undefined reference to `stree_add_string'
main.c:(.text+0x2a7): undefined reference to `stree_match'
main.c:(.text+0x38f): undefined reference to `int_stree_set_idents'
main.c:(.text+0x422): undefined reference to `int_stree_get_parent'
main.c:(.text+0x47b): undefined reference to `int_stree_get_suffix_link'
/tmp/cc4H83rG.o: In function `count_freq':
main.c:(.text+0x96d): undefined reference to `int_stree_set_idents'
main.c:(.text+0x9a8): undefined reference to `stree_get_num_leaves'
main.c:(.text+0xa91): undefined reference to `int_stree_set_idents'
/tmp/cc4H83rG.o: In function `select_feature':
main.c:(.text+0xb34): undefined reference to `int_stree_set_idents'
main.c:(.text+0xbe7): undefined reference to `stree_get_num_children'
main.c:(.text+0xc47): undefined reference to `int_stree_get_parent'
main.c:(.text+0xc67): undefined reference to `int_stree_set_idents'
main.c:(.text+0xc94): undefined reference to `int_stree_get_parent'
main.c:(.text+0xdbb): undefined reference to `int_stree_get_suffix_link'
main.c:(.text+0xddb): undefined reference to `int_stree_set_idents'
main.c:(.text+0xe08): undefined reference to `int_stree_get_suffix_link'
collect2: ld returned 1 exit status
The tarball you linked to contains source code. To run the code you need to compile it into an executable. You can then run the executable if the compilation succeeds.
Here are the files you should have to start with, directly from the tar file:
Compile
First we’ll compile the program. The
-o ksgnames the executableksg. When gcc displays nothing that means it succeeded without any errors or warnings.Run
Now we can run the
ksgexecutable we just created. The command-line syntax is./ksg <arguments>. For example, we can ask for help with./ksg -?: