I am having problems when trying to use SWIG to access C++-code from my GO-code.
My simplistic setup is:
Simple.h:
#include <iostream>
class SimpleSwig
{
public:
void hello_world();
};
Simple.cpp:
#include "Simple.h"
void hello_world()
{
std::cout << "hello world\n";
}
simple.i:
%module simple
%{
#include "Simple.h"
%}
%include Simple.h
main.go:
package main
import "fmt"
import "ctogoswig/swig"
func main() {
fmt.Println("go ...")
s := simple.NewSimpleSwig()
s.Hello_world()
fmt.Println("done")
}
Issuing
$ swig -go -c++ -intgosize 64 .\simple.swigcxx
gives me the new files simple.go and simple_wrap.cxx.
When I then issue
$ go install
I am getting:
A call to
$ go build -x
yields:
My Go environment variables are:
So, what am I missing?
The mentioned line 277 in the "undefined reference" exception is within the file simple_wrap.cxx:
Maybe also relevant is that within this file the following include is present a little before line 277: