libgit2 / libgit2

A cross-platform, linkable library implementation of Git that you can use in your application.

Home Page:https://libgit2.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Merge example is outdated

wiiznokes opened this issue · comments

For example, i think

merge_options_init(&opts);

sould be

git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT;

Both should work! One is not newer or better than the other if you’re using C. (I guess the static initializer avoids a function call which might be nice, but if you were building an FFI into libgit2 then you would probably prefer the API.)

Oh yes mb, i guess i didn't see the function at the top.

Sorry for asking here but do you have any idea why i can't compile the merge example?

examples$ gcc merge.c -lgit2
/usr/bin/ld : /tmp/cc7tiHiw.o : dans la fonction « opts_add_refish » :
merge.c:(.text+0x106) : référence indéfinie vers « xrealloc »
/usr/bin/ld : /tmp/cc7tiHiw.o : dans la fonction « parse_options » :
merge.c:(.text+0x210) : référence indéfinie vers « match_str_arg »
/usr/bin/ld : /tmp/cc7tiHiw.o : dans la fonction « resolve_heads » :
merge.c:(.text+0x2d0) : référence indéfinie vers « resolve_refish »
/usr/bin/ld : /tmp/cc7tiHiw.o : dans la fonction « output_conflicts » :
merge.c:(.text+0x719) : référence indéfinie vers « check_lg2 »
/usr/bin/ld : /tmp/cc7tiHiw.o : dans la fonction « create_merge_commit » :
merge.c:(.text+0x8af) : référence indéfinie vers « check_lg2 »
/usr/bin/ld : merge.c:(.text+0x8d5) : référence indéfinie vers « resolve_refish »
/usr/bin/ld : merge.c:(.text+0x965) : référence indéfinie vers « check_lg2 »
/usr/bin/ld : merge.c:(.text+0x99d) : référence indéfinie vers « check_lg2 »
/usr/bin/ld : merge.c:(.text+0x9da) : référence indéfinie vers « check_lg2 »
/usr/bin/ld : merge.c:(.text+0xaf8) : référence indéfinie vers « check_lg2 »
/usr/bin/ld : merge.c:(.text+0xb93) : référence indéfinie vers « check_lg2 »
/usr/bin/ld : /tmp/cc7tiHiw.o:merge.c:(.text+0xbc8) : encore plus de références indéfinies suivent vers « check_lg2 »
collect2: error: ld returned 1 exit status