当我在 macos 中运行代码时
cd ./build
brew install gcc@9
cmake -DCMAKE_C_COMPILER=/usr/local/bin/gcc-9 -
DCMAKE_CXX_COMPILER=/usr/local/bin/g++-9 ../cpp_rebucket/
make
然后
go build -o bin/alert src/alert/main/alert.go
结果是
ld: warning: ignoring file ./build/libcpp_rebucket.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture x86_64:
"_C_get_dist", referenced from:
__cgo_7af90c034622_Cfunc_C_get_dist in _x002.o (也许你的意思是:__cgo_7af90c034622_Cfunc_C_get_dist) clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)