CGO usage in windows


(ravuri sai ram akhil) #1
package main

//#include<sqlcli1.h>
import "C"

import "fmt"

func main(){
	fmt.Println(C.SQL_API_SQLCOLUMNS)
}

sqlcli1.h file is in C:\Program Files\IBM\SQLLIB\include

The program file is in C:\Go\Programs

Error:-

# command-line-arguments
.\calling.go:3:20: fatal error: sqlcli1.h: No such file or directory
 //#include<sqlcli1.h>
                    ^
compilation terminated.

How to link sqlcli1.h file to the program.go file.

My env varibles

C:\Go\programs>go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\rakhil\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\rakhil\go
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\rakhil\AppData\Local\Temp\go-build674647070=/tmp/go-build -gno-record-gcc-switches

(Eric Lindblad) #2

Pardon me, but you never cleaned up your code in the following.

New to cgo - unable to include header