I have some C files that I have included in my go project using cgo. When they are in the root folder of my go packages, my import looks like this:
/*
#cgo CFLAGS: -std=c99 -I .
#include <stdlib.h>
#include <gopcua_client.h>
*/
import "C"
This builds fine, everything works. However, I want to move the .c and .h files into a subfolder ./include. I tried this, and changed the import to :
/*
#cgo CFLAGS: -std=c99 -I ./include
#include <stdlib.h>
#include <gopcua_client.h>
*/
import "C"
Now I get an error for every C function I use in the go-file:
/tmp/go-build184824875/github.com/coussej/gopcua/_obj/gopcua.cgo2.o:
In function `_cgo_38ec0a5d28b6_Cfunc_gopcua_read_int32':
./gopcua.go:116: undefined reference to `gopcua_read_int32'
I'm not familiar with C, so I'm in the dark here. Thanks in advance.