I am looking into using Swig to bring some C++ libraries into Ruby.
I’m not extremely C++ proficient, but know the basics. Anyway, I’m
having issues with using “cout” within Swig. I’ve put together a
small test case here:
=== hello.h ===
#include
void hello_world() {
std::cout << “hello world”;
}
=== hello.i ===
%module example
%{
#include “hello.h”
%}
%include “hello.h”
=== extconf.rb ===
require ‘mkmf’
$libs = append_library($libs, “supc++”)
create_makefile(‘hello’)
Commands:
% swig -c++ -ruby hello.i
% ruby extconf.rb
% make
% ruby -e ‘require “hello”’
./hello.so: ./hello.so: undefined symbol: _ZSt4cout - ./hello.so
(LoadError)
from -e:1
Please help me on this… is this an issue with dynamic linking?
Thanks,
-James