Home > Enterprise >  Go cgo - ignore C source files on windows
Go cgo - ignore C source files on windows

Time:02-28

I have a lib, that uses some C on linux. On windows it is just a dummy noop lib with functions that do nothing.

The lib is in 3 files: lib_linux.go, lib_win.go and lib.c

But when I try to compile it on windows, it throws this error: C source files not allowed when not using cgo or SWIG: lib.c

How can I tell to the go compiler to ignore the C source files on windows?

CodePudding user response:

A similar issue suggests (when tailored to your case):

workarounds

  • Related