Help save net neutrality! Learn more.
Close

acdk_java failed to compile

Help
2006-04-14
2013-03-22
  • Fernando Gomes

    Fernando Gomes - 2006-04-14

    Hi!

    I've got the following error ...
    acdk/java/jniext.h:185: error: `_t' undeclared (first use this function)

    with gcc-4.0.2 then i stepped back to gcc-3.4.5 and got the same results. I also added -fpermissive to CCOMPILER... but without success! :-(

    Below you can see some info about my environment and error messages. Btw: everything compiled OK, except acdk_java and acdk_wx.

    Any idea?

    Thanks

    Fernando Gomes

    fgomes@sirius:~/workspace/acdk/acdk_java$ uname -a
    Linux sirius 2.6.12-10-386 #1 Sat Mar 11 16:13:17 UTC 2006 i686 GNU/Linux

    fgomes@sirius:~/workspace/acdk/acdk_java$ gcc -v
    Reading specs from /usr/lib/gcc/i486-linux-gnu/3.4.5/specs
    Configured with: ../src/configure -v --enable-languages=c,c++,f77,pascal,objc,ada --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug i486-linux-gnu
    Thread model: posix
    gcc version 3.4.5 20050809 (prerelease) (Ubuntu 3.4.4-6ubuntu8.1)

    fgomes@sirius:~/workspace/acdk/acdk_java$ g++ -v
    Reading specs from /usr/lib/gcc/i486-linux-gnu/3.4.5/specs
    Configured with: ../src/configure -v --enable-languages=c,c++,f77,pascal,objc,ada --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug i486-linux-gnu
    Thread model: posix
    gcc version 3.4.5 20050809 (prerelease) (Ubuntu 3.4.4-6ubuntu8.1)

    fgomes@sirius:~/workspace/acdk/acdk_java$ echo $CCOMPILER
    g++ -Wall -Wno-unused -fpermissive

    fgomes@sirius:~/workspace/acdk/acdk_java$ make
    cd src; make -f acdk_java.linux
    make[2]: Entering directory `/home/fgomes/workspace/acdk/acdk_java/src'
    g++ -Wall -Wno-unused -fpermissive -fpic -ggdb   -I .  -I ../../include   -DACDK_HAS_LIBERTY -D__SMP__  -DOS_LINUX -D_REENTRANT -DIN_ACDK_JAVA_LIB   -I /usr/lib/j2sdk1.4-sun/include -I /usr/lib/j2sdk1.4-sun/include/linux -o ../tobj/acdk_java/linux/acdk2java.o -c acdk/java/acdk2java.cpp
    In file included from acdk/java/acdk2java.h:29,
                     from acdk/java/acdk2java.cpp:26:
    acdk/java/jniext.h: In constructor `acdk::java::JStringImpl<R>::JStringImpl(JNIEnv*, const acdk::lang::RString&)':
    acdk/java/jniext.h:181: error: `_t' undeclared (first use this function)
    acdk/java/jniext.h:181: error: (Each undeclared identifier is reported only once for each function it appears in.)
    acdk/java/jniext.h: In member function `acdk::java::JStringImpl<R>& acdk::java::JStringImpl<R>::operator=(_jstring*)':
    acdk/java/jniext.h:185: error: `_t' undeclared (first use this function)
    acdk/java/jniext.h: In member function `acdk::java::JStringImpl<R>& acdk::java::JStringImpl<R>::operator=(const acdk::java::JStringImpl<R>&)':
    acdk/java/jniext.h:193: error: `_t' undeclared (first use this function)
    acdk/java/jniext.h: In member function `acdk::java::JStringImpl<R>& acdk::java::JStringImpl<R>::operator=(const char*)':
    acdk/java/jniext.h:201: warning: there are no arguments to `dispose' that depend on a template parameter, so a declaration of `dispose' must be available
    acdk/java/jniext.h:203: error: `_t' undeclared (first use this function)
    acdk/java/jniext.h: In member function `int acdk::java::JStringImpl<R>::length() const':
    acdk/java/jniext.h:216: error: `_t' undeclared (first use this function)
    acdk/java/jniext.h: In member function `void acdk::java::JStringImpl<R>::clearString()':
    acdk/java/jniext.h:241: error: `_t' undeclared (first use this function)
    acdk/java/jniext.h: In member function `const char* acdk::java::JStringImpl<R>::cstr() const':
    acdk/java/jniext.h:250: error: `_t' undeclared (first use this function)
    acdk/java/jniext.h: In member function `int acdk::java::JObjectArrayImpl<R>::length() const':
    acdk/java/jniext.h:287: error: `_t' undeclared (first use this function)
    acdk/java/jniext.h: In member function `acdk::java::JObject acdk::java::JObjectArrayImpl<R>::operator[](int)':
    acdk/java/jniext.h:296: error: `_t' undeclared (first use this function)
    acdk/java/jniext.h: In member function `acdk::lang::RString acdk::java::JClassImpl<R>::getName()':
    acdk/java/jniext.h:355: error: `_t' undeclared (first use this function)
    acdk/java/jniext.h: In member function `_jobject* acdk::java::JClassImpl<R>::getField(const acdk::lang::RString&)':
    acdk/java/jniext.h:359: error: `_t' undeclared (first use this function)
    make[2]: *** [../tobj/acdk_java/linux/acdk2java.o] Error 1
    make[2]: Leaving directory `/home/fgomes/workspace/acdk/acdk_java/src'
    make[1]: *** [acdk_java] Error 2

     
    • Roger Rene Kommer

      Hi,

      The gcc version 4.0.x has some problems with templates.
      At my first experience the 4.1.x is much better in this regard.

      > acdk/java/jniext.h:185: error: `_t' undeclared (first use this function)
      I just had a short look at the code, and it seems to be ok. _t is just
      a member variable of the super class.

      2 possible workarounds, but not tested by myself:

      Replace:

      template <class T, class R = JLocalRes>
      class JObjectImpl
      {
      protected:
        //JNIEnv* _env;
        T _t;
       
      with
      template <class T, class R = JLocalRes>
      class JObjectImpl
      {
      public: // make it public
        //JNIEnv* _env;
        T _t;
       
       
      or
      inside the class JStringImpl replace the reference to _t with JObjectImpl<jstring, R> ::_t.

      Regarding acdk_wx.
      You have to compile the external wxWidget libraries with the same compiler version, as acdk.
      Not all wxWidget versions are working with each version of gcc.

      In the CVS repository I made various fixes to make the most current version of wxWidget with
      with gcc 4.1 working with acdk.

      If want to try the current alpha version please refer to.
      https://sourceforge.net/forum/forum.php?forum_id=548980

      Regards,
      Roger Rene Kommer

       

Log in to post a comment.