On Fri, Jun 23, 2017 at 10:53 PM, <jkle...@ucdavis.edu> wrote:

> Thanks. My .go file contains just the following:
>
> package mypackage
> // #cgo CXXFLAGS: -I/usr/folder/subfolder
> import "C"
>
> and when I do "go build" or "go build -x" I get an error that the #include
> library i'm using is not found. has anyone run into this before?
>

I've just tried this (with go-1.8.3):

$ pwd
/home/binet/dev/go/gocode/src/github.com/sbinet/mypackage

$ tree .
.
├── lib.cxx
├── pkg.go
└── subdir
    └── lib.h

1 directory, 3 files


$ cat pkg.go
package mypackage

// #cgo CXXFLAGS: -I/home/binet/dev/gocode/src/github.com/sbinet/mypackage
import "C"

$ cat lib.cxx
#include "subdir/lib.h"

int foo() {
 return 42;
}

$ cat subdir/lib.h
#ifndef SUBDIR_LIB_H
#define SUBDIR_LIB_H 1

int foo();

#endif

and 'go build' worked:

$ go build .
$ echo $?
0

how does this fail (if it does) for you ?

-s

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to