Without seeing anything my first guess would be that you should change struct { to class { public: and instead of malloc() and free use new and delete.