cmd/go: cgo is not compiling C files in current directory #24592
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ekanwli/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/ws/proj/playground/go"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build388128647=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I am trying to create a CGO program with separate C source file in the same directory. As mentioned in the official Cgo docs, Cgo will compile all C files in the same directory but in this case, it is not compiling the C file. And later gives a linker error.
myTest.go
myTest.h
void print_str(char *s);
myTest.c
What did you expect to see?
I expected that all C files in the current directory are compiled by
go build
What did you see instead?
While compiling, I am getting the following error:
The text was updated successfully, but these errors were encountered: