【发布时间】:2020-11-16 21:54:24
【问题描述】:
我有如下代码(commit_id 已经设置):
git_note* note;
git_note_read(¬e, repo, "refs/notes/label", &commit_oid);
printf("%s\n", note->message);
git_note_free(note);
它不编译,抱怨:
.../importer_test.cc:103:22: error: member access into incomplete type 'git_note'
printf("%s\n", note->message);
^
.../include/git2/types.h:160:16: note: forward declaration of 'git_note'
typedef struct git_note git_note;
如果我只是从src/notes.h 复制/粘贴到这个文件中:
struct git_note {
git_oid id;
git_signature *author;
git_signature *committer;
char *message;
};
它可以正确编译和运行。但这肯定不是正确的解决方案吗?
【问题讨论】:
标签: libgit2