Cgo compilation error could not find so file

refer to Comprehensive summary: Golang calls so, CPP, example tutorial learn how to use cgo to call CPP, but compilation always fails, please give me some advice.

chen@chen-pc:~/git/go/src/ff$ tree
.
 include
    video.c
    video.h
 lib
    libvideo.so
 main.go

2 directories, 4 files
chen@chen-pc:~/git/go/src/ff$ go build
-sharp ff
/usr/bin/x86_64-linux-gnu-ld:  -llibvideo
collect2: error: ld returned 1 exit status
is inconsistent with blog posts in that there is no src directory, so when main.go is placed in this directory, go build will prompt that video.h cannot be found
Mar.11,2021

is an error in the blog post. -lxxx of LDFLAGS should not have the lib prefix. I have rearranged https://github.com/meilihao/t.

Menu