【发布时间】:2018-12-04 10:00:07
【问题描述】:
我想在 Golang 中调用 C 代码:
// #cgo CFLAGS: -I/usr/include/c++/8.1.1/bits
// #cgo CXXFLAGS: -std=gnu++11
// #include "c++0x_warning.h"
import "C"
但得到错误:
In file included from ./main.go:5:
/usr/include/c++/8.1.1/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
所以 cgo 不使用 CXXFLAGS。我试过-std=c++11,它也不起作用。我做错了什么?
$ go version
go version go1.10.3 linux/amd64
【问题讨论】: