Page 1 of 1

Compiling with Cimage use failed with link error.

Posted: Thu Mar 22, 2012 5:30 pm
by wanliqun
I'm trying to make some use of CImage with jirr. Here is the generated code by swig for this:

Code: Select all

 
SWIGEXPORT void JNICALL Java_net_sf_jirr_JirrJNI_CImage_1drawLine(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) {
  irr::video::CImage *arg1 = (irr::video::CImage *) 0 ;
  irr::core::vector2d< irr::s32 > *arg2 = 0 ;
  irr::core::vector2d< irr::s32 > *arg3 = 0 ;
  irr::video::SColor *arg4 = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  (void)jarg3_;
  (void)jarg4_;
  arg1 = *(irr::video::CImage **)&jarg1; 
  arg2 = *(irr::core::vector2d< irr::s32 > **)&jarg2;
  if (!arg2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "irr::core::vector2d< irr::s32 > const & reference is null");
    return ;
  } 
  arg3 = *(irr::core::vector2d< irr::s32 > **)&jarg3;
  if (!arg3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "irr::core::vector2d< irr::s32 > const & reference is null");
    return ;
  } 
  arg4 = *(irr::video::SColor **)&jarg4;
  if (!arg4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "irr::video::SColor const & reference is null");
    return ;
  } 
  (arg1)->drawLine((irr::core::vector2d< irr::s32 > const &)*arg2,(irr::core::vector2d< irr::s32 > const &)*arg3,(irr::video::SColor const &)*arg4);
}
 
Unfortunately I got a link error as follows:
1>jirr_wrap.obj : error LNK2019: unresolved external symbol "public: void __thiscall irr::video::CImage::drawLine(class irr::core::vector2d<int> const &,class irr::core::vector2d<int> const &,class irr::video::SColor const &)" (?drawLine@CImage@video@irr@@QAEXABV?$vector2d@H@core@3@0ABVSColor@23@@Z) referenced in function _Java_net_sf_jirr_JirrJNI_CImage_1drawLine@561
What confused me more is that the interfaces of the other classes seem to be all right after commenting

Code: Select all

(arg1)->drawLine((irr::core::vector2d< irr::s32 > const &)*arg2,(irr::core::vector2d< irr::s32 > const &)*arg3,(irr::video::SColor const &)*arg4);

I've double-checked my irrlicht lib & dll project, and make sure that Cimage.cpp is added to the project. I'm using VC++2008, on windows XP, any clue on this?

Re: Compiling with Cimage use failed with link error.

Posted: Sat Mar 24, 2012 2:30 pm
by gerdb
hi,

CImage is not public in <irrlicht.h>, but IImage is ( regardless if linking with lib or dll )

maybe do a include statement like

#include <irrlicht.h>
#include <../source/Irrlicht/CImage.h>

if the first works, the second will too

Re: Compiling with Cimage use failed with link error.

Posted: Sat Mar 24, 2012 4:44 pm
by wanliqun
Hi, gerdb, I'm pretty sure I've add the cimage.h into the include path and #included into my project. There is some interface like drawRectangle, drawLines is not defined in IImage interface. I'm using irrlich 1.7.2, maybe I need to compare my current version with the latest svn release.