Skip to main content

Posts

Showing posts from August, 2006

Ruby and SWIG errors and solutions

While working on my GDK for Ruby I had to use SWIG to create a C++ extension to rub. The following are the errors encountered and their solutions: Error: /usr/local/lib/site_ruby/1.8/i486-linux/calvarygdk.so: /usr/local/lib/site_ruby/1.8/i486-linux/calvarygdk.so: undefined symbol: _ZTV6Vector - /usr/local/lib/site_ruby/1.8/i486-linux/calvarygdk.so (LoadError) from test.rb:1 Solution: I did not have the Vector.cpp file in the same folder as the .i file. Error: test.rb:9: uninitialized constant Calvarygdk::Quaternion (NameError) Solution: I forgot to put a % instead of # at the beginning of the line here in the .i file: ============================== /* File : example.i */ %module calvarygdk %{ #include "Vector.h" #include "Quaternion.h" %} /* Let's just grab the original header file here */ %include "Vector.h" %include "Quaternion.h" /* <--------------------------- Right here was the problem, I had # instead of % */ ==========