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 % */
==============================
Error:
gcc -shared -L"/usr/lib" -o calvarygdk.so calvarygdk_wrap.o Vector.o Quaternion.o DefaultTriMeshData.o -lruby1.8 -lsupc++ -lpthread -ldl -lcrypt -lm -lc
gcc: DefaultTriMeshData.o: No such file or directory
make: *** [calvarygdk.so] Error 1
Solution
Changed the object line to point to a real .o file. In this case a previously generated .o file for DefaultTriMeshData
===========Makefile==========
OBJS = calvarygdk_wrap.o Vector.o Quaternion.o graphics/DefaultTriMeshData.o
=============================
Error:
g++ -fPIC -Wall -g -O2 -fPIC -I. -I/usr/lib/ruby/1.8/i486-linux -I/usr/lib/ruby/1.8/i486-linux -I../ -I/home/jtarquino/irrlicht-1.0/include -I"/usr/X11R6/include" -L"/usr/X11R6/lib" -L"/home/jtarquino/irrlicht-1.0/lib/Linux" -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11 -c ../Quaternion.cpp
g++: -lIrrlicht: linker input file unused because linking not done
g++: -lGL: linker input file unused because linking not done
g++: -lGLU: linker input file unused because linking not done
g++: -lXxf86vm: linker input file unused because linking not done
g++: -lXext: linker input file unused because linking not done
g++: -lX11: linker input file unused because linking not done
gcc -shared -L"/usr/lib" -o calvarygdk.so calvarygdk_wrap.o Vector.o Quaternion.o DefaultTriMeshData.o -lruby1.8 -lsupc++ -lpthread -ldl -lcrypt -lm -lc
gcc: DefaultTriMeshData.o: No such file or directory
make: *** [calvarygdk.so] Error 1
Solutions":
The lib problem with gcc was solved by setting the lib path of the makefile and the libs as:
========Makefile=============
LIBPATH = -L"$(libdir)" -L"/usr/X11R6/lib" -L"/home/jtarquino/irrlicht-1.0/lib/Linux"
LIBS = $(LIBRUBYARG_SHARED) -lsupc++ -lpthread -ldl -lcrypt -lm -lc -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11
=============================
Also, I had to put the DefaultTriMeshData in the folder manually, I don't know why. Th object was in /home/jtarquino/cjptgames/.objs/calvaryfx/src/graphics.
Error:
g++ -fPIC -g -O2 -lpthread -I. -I/usr/lib/ruby/1.8/i486-linux -I/usr/lib/ruby/1.8/i486-linux -I../ -I/home/jtarquino/irrlicht-1.0/include -I"/usr/X11R6/include" -c calvarygdk_wrap.cxx
calvarygdk_wrap.cxx: In function `VALUE _wrap_TriMeshData_setIndices(int,
VALUE*, long unsigned int)':
calvarygdk_wrap.cxx:3731: warning: converting to non-pointer type `int' from
NULL
calvarygdk_wrap.cxx:3736: error: invalid conversion from `int' to `void*'
calvarygdk_wrap.cxx:3741: error: invalid conversion from `int' to `void*'
calvarygdk_wrap.cxx: In function `VALUE
_wrap_new_DefaultTriMeshData__SWIG_1(int, VALUE*, long unsigned int)':
calvarygdk_wrap.cxx:3922: warning: converting to non-pointer type `int' from
NULL
calvarygdk_wrap.cxx:3948: error: invalid conversion from `int' to `void*'
calvarygdk_wrap.cxx:3953: error: invalid conversion from `int' to `void*'
calvarygdk_wrap.cxx: In function `VALUE
_wrap_DefaultTriMeshData_setIndices(int, VALUE*, long unsigned int)':
calvarygdk_wrap.cxx:4060: warning: converting to non-pointer type `int' from
NULL
calvarygdk_wrap.cxx:4065: error: invalid conversion from `int' to `void*'
calvarygdk_wrap.cxx:4070: error: invalid conversion from `int' to `void*'
make: *** [calvarygdk_wrap.o] Error 1
Solution:
When I looked at the generated code at line with the error I saw an invalid pointer conversion. In the .i file I was freeing the object as and int
instead of a int*:
=============.i file==============
%typemap(freearg) int * {
free((int*) $1); /* This was (int) $1 before
}
==================================
Error:
../irr/GraphicBoundingBoxIrr.h:12: Error: Nothing known about namespace 'irr'
../irr/GraphicBoundingBoxIrr.h:13: Error: Nothing known about namespace 'irr::scene'
../irr/GraphicBoundingBoxIrr.h:14: Error: Nothing known about namespace 'irr::video'
../irr/GraphicIrr.h:13: Error: Nothing known about namespace 'irr'
../irr/GraphicIrr.h:14: Error: Nothing known about namespace 'irr::scene'
../irr/GraphicIrr.h:15: Error: Nothing known about namespace 'irr::video'
../irr/AnimatedGraphicIrr.h:13: Error: Nothing known about namespace 'irr'
../irr/AnimatedGraphicIrr.h:14: Error: Nothing known about namespace 'irr::scene'
../irr/AnimatedGraphicIrr.h:15: Error: Nothing known about namespace 'irr::video'
../irr/GraphicsEngineIrr.h:11: Error: Nothing known about namespace 'irr'
../irr/GraphicsEngineIrr.h:12: Error: Nothing known about namespace 'irr::scene'
../irr/GraphicsEngineIrr.h:13: Error: Nothing known about namespace 'irr::video'
../irr/GraphicsFactoryIrr.h:14: Error: Nothing known about namespace 'irr'
../irr/GraphicsFactoryIrr.h:15: Error: Nothing known about namespace 'irr::scene'
../irr/GraphicsFactoryIrr.h:16: Error: Nothing known about namespace 'irr::video'
../irr/UtilIrr.h:11: Error: Nothing known about namespace 'irr'
../irr/UtilIrr.h:12: Error: Nothing known about namespace 'irr::scene'
../irr/UtilIrr.h:13: Error: Nothing known about namespace 'irr::core'
../irr/ResourceIrr.h:11: Error: Nothing known about namespace 'irr'
../irr/ResourceIrr.h:12: Error: Nothing known about namespace 'irr::scene'
../irr/ResourceIrr.h:13: Error: Nothing known about namespace 'irr::video'
../irr/GraphicsEngineIrr.h:19: Warning(401): Nothing known about base class 'IEventReceiver'. Ignored.
Solution:
I included in the .i file the Irrlicht.h file that was being included in every file.
=========================================================================================
test.rb:14:in `initialize': in method 'initialize', argument 1 of type 'PhyFactoryOde *' (ObjectPreviouslyDeleted)
from test.rb:14:in `run_game'
from test.rb:55
Solution: avoided the name initialized for the phy factory. Also for the phy engine, which was being started by the factory inside the
initialize method.
The following Powershell script will convert a batch of JPEG files to TIFF format: #This Code is released under MIT license [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") $files_folder = 'C:\path-where-your-jpg-files-are\' $pdfs = get-childitem $files_folder -recurse | where {$_.Extension -match "jpg"} foreach($pdf in $pdfs) { $picture = [System.Drawing.Bitmap]::FromFile( $pdf.FullName ) $tiff = $pdf.FullName.replace('.PDF','').replace('.pdf','').replace('.jpg','').replace('.JPG','') + '.tiff' $picture.Save($tiff) }
Comments