Go CGO usage, novice easy to meet the third party C language Library of the library file or header file is not found in the case

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.