在Go程序中嵌入C ++可执行函数

My goal is to include a function I have in a compiled executable into a go program.

My directory structure is set up as follows:

ProjectDir/
    include/
        <header files>
    main.go
    libMyLibrary.dylib
    otherMain.cpp
    otherMain.hpp

My go file is as follows

package main

/*
#cgo CFLAGS: -I include
#cgo LDFLAGS: -framework Cocoa -L ./ -lMyLibrary
#include "otherMain.hpp"
gtype_real64 myFunction();
*/
import "C"
import "fmt"

func main() {
    fmt.Println(C.myFunction());
}

However, when I try to run go build main.go I get the following error from the linker:

# command-line-arguments
Undefined symbols for architecture x86_64:
  "_myFunction", referenced from:
      __cgo_159d40466606_Cfunc_myFunction in main.cgo2.o
     (maybe you meant: __cgo_159d40466606_Cfunc_myFunction)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've been puzzling over this and can't see as to why the linker can't find the library. Any ideas?

otherMain.hpp:

#include <stdio.h>
#include <string.h>
#include <memory.h>

#include <Carbon/Carbon.h>

#define MAX_NUM_MEASUREMENTS 100

#include "<a header file in include>.h"

int main(int argc, char* argv[]);
gtype_real64 myFunction();