I have a typedef enum struct defined as such
typedef enum struct EnumStructName : int { Val1, Val2, Val2 } EnumStructName;
When I am compiling the C++ code on my Mac its working fine. And its creating a proper library (.a) file and all the tests pass.
I then use the library in my Golang Code base using the following flags:
//#cgo CXXFLAGS: -std=c++17
//#cgo CXXFLAGS: -I../lib/inc -I/usr/local/include
//#cgo LDFLAGS: -L../lib/build/ -lengine -lstdc++ -lm
//#include <stdbool.h>
//#include <stdlib.h>
import "C"
I get the following error when I try to build with golang using Clang
CC=clang go build
gives the following error:
error: expected identifier or '{'
typedef enum struct EnumStructName : int { Val1, Val2, Val2 } EnumStructName;
^
The thing is it builds fine on Linux (and on Linux Docker Images) – just not on my Mac. Any idea why this might be the case?
8