After upgrading from version Go 14 to version 15, C is called.

I am trying to call a C shared library from Go, but i always get an error

command-line-arguments
cgo: exec C:\Program: exec: “C:\Program”: file does not exist

Today, I upgraded my go from 1.14 to 1.15. This prompt will appear when I run any project related to calling C after upgrading.

I can work normally when I use 1.14.

package main

import "C"
import "fmt"

func main() {
	fmt.Println(C.add(1, 3))
}

I’ve installed it Mingw-w64

If you build and run through your terminal rather than some IDE buttons?

I tried to use the terminal to run, in the terminal it is normal

Finally, I put mingw-w64 in a directory without spaces, so that the IDE and the terminal can run normally

Thank you for your help

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.