This is a created article in which the information may have evolved or changed.
The situation I met was
Under the Windows platform MinGW compiled using a third-party C-language library, I need to set environment variables for MinGW to indicate that MinGW's gcc command compiles when looking for header files and library file directories
And CGO doesn't seem to care or deny the environment variables I set for MinGW
Need to set the address of the header file and library file yourself
such as the use of CGO parameters
#cgo CFLAGS:-I.. /.. /cinclude
#cgo ldflags:-L. /.. /clib-lgsasl
#include <gsasl.h>
......
CFLAGS
The top indicates the header file address
Ldflags
The bottom indicates the library file address
is the relative position of the current file
-I (Uppercase) indicates the header file directory
-L indicates that the library file directory-l (l lowercase) indicates that a specific library file is used
Thank you for this piece of paper that reminds me.
http://hi.baidu.com/grandyang/item/eefe9932e971eff6a884288f