Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22059

Problems with import "C"

$
0
0

I'm trying to get GO to compile a simple test script on Windows 10 using GoLand but am running into problems. Here is the code:

package main

import "fmt"

import "C"

import (
    "math"
)

func main() {
fmt.Println("working")
}
//export add
 func add( a , b int) int {
    return a + b
}
//export Cosine
func Cosine(x float64) float64 {
    return math.Cos(x)
}

When I comment out the import "C" line the code compiles fine but when its there I get

exec: "gcc": executable file not found in %PATH%

So I installed MinGW and added its bin to the PATH variable so that in a cmd prompt I can run

C:\GolandProjects\LearnGoProject>gcc
gcc: fatal error: no input files
compilation terminated.

However I'm still getting the error. Could anybody suggest how to fix the issue?


Viewing all articles
Browse latest Browse all 22059

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>