golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.07k stars 17.68k forks source link

x/mobile/cmd/gomobile: can't recognition bool #22875

Closed wpajqz closed 6 years ago

wpajqz commented 6 years ago

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.9.2 darwin/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64" GOBIN="/Users/Paul/go/bin" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/Paul/gopkg:/Users/Paul/go" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/59/jdr4qmx15h17wq4d20hjkbq00000gn/T/go-build794677240=/tmp/go-build -gno-record-gcc-switches -fno-common" CXX="clang++" 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"### What did you do?

If possible, provide a recipe for reproducing the error. A complete runnable program is good. A link on play.golang.org is best.

type Client struct { debug bool }

func (c *Client) SetDebug(bool bool) { c.debug = bool }

What did you expect to see?

What did you see instead?

go build -pkgdir=/Users/Paul/gopkg/pkg/gomobile/pkg_darwin_arm -tags ios -buildmode=c-archive -o /var/folders/59/jdr4qmx15h17wq4d20hjkbq00000gn/T/gomobile-work-341500227/export-arm.a /var/folders/59/jdr4qmx15h17wq4d20hjkbq00000gn/T/gomobile-work-341500227/src/iosbin/main.go failed: exit status 2

_/var/folders/59/jdr4qmx15h17wq4d20hjkbq00000gn/T/gomobile-work-341500227/src/gomobile_bind

In file included from Export.m:9: /var/folders/59/jdr4qmx15h17wq4d20hjkbq00000gn/T/gomobile-work-341500227/src/gomobile_bind/Export.objc.h:86:24: error: expected identifier /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/stdbool.h:31:14: note: expanded from macro 'bool' In file included from Export.m:9: /var/folders/59/jdr4qmx15h17wq4d20hjkbq00000gn/T/gomobile-work-341500227/src/gomobile_bind/Export.objc.h:86:24: error: expected ';' after method prototype Export.m:184:24: error: expected identifier /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/stdbool.h:31:14: note: expanded from macro 'bool' Export.m:184:24: error: expected method body /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/stdbool.h:31:14: note: expanded from macro 'bool'

wpajqz commented 6 years ago

type Client struct { debug bool }

func (c *Client) SetDebug(b bool) { c.debug = b }

it's ok when I run gomobile bind -target=ios

gopherbot commented 6 years ago

Change https://golang.org/cl/100795 mentions this issue: bind: add nil and bool to ObjC keyword list