Go cgo – ignore C source files on windows


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?


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


Answered By – VonC

Answer Checked By – Marie Seifert (GoLangFix Admin)

Leave a Reply

Your email address will not be published.