简体   繁体   中英

How do you set up golang on windows with the header files for goav

I'm trying to compile goav on Windows and I've got quite far I've compiled the ffmpeg libraries in MSYS2 and linked the packages with:

set PKG_CONFIG_PATH=%~dp0FFmpeg\libavformat;%~dp0FFmpeg\libavcodec;%~dp0FFmpeg\libavutil;%~dp0FFmpeg\libswresample;

which has worked!

However, here's the problem now:

# github.com/giorgisio/goav/avcodec
source\src\github.com\giorgisio\goav\avcodec\avcodec.go:14:34: fatal error: libavformat/avformat.h: No such file or directory
 //#include <libavformat/avformat.h>

When compiling, Golang can't find the avformat.h (and I assume the other ffmpeg header files, but compilation terminated).

How do I tell go where these files are? I've checked and they are in the folders described in the PKG_CONFIG_PATH, but I guess it's not looking for them there.

Side note: I see that on linux-debian based systems I just have to do a apt-get install libavformat-dev but I want to compile on windows.

The solution to my problem was to set the CGO_CFLAGS environment variable before building to tell the compiler where the include files are for ffmpeg:

@set CGO_CFLAGS=-IC:\path\to\FFmpeg\

... My project is still not building, but that error isn't showing up anymore

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM