Find the answer to your Linux question:
Results 1 to 1 of 1
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Aug 2005
    Location
    Italy
    Posts
    401

    g++ error incomprensible for me


    Hi... I'm new to C++ programming, so Im't not friend of g++ error reporting...

    This is what report g++:

    /bin/sh ../libtool --mode=link g++ -g -O2 -o tween-test tween-test.o winsys/libwinsys.a -L/usr/X11R6/lib -lXext -lX11 -L/usr/lib -ldl -lartsc -lpthread -lgmodule-2.0 -ldl -lgthread-2.0 -lglib-2.0 -lmcheck -lGL
    g++ -g -O2 -o tween-test tween-test.o winsys/libwinsys.a -L/usr/X11R6/lib -lXext -lX11 -L/usr/lib /usr/lib/libartsc.so -lpthread /usr/lib/libgmodule-2.0.so -ldl /usr/lib/libgthread-2.0.so /usr/lib/libglib-2.0.so -lmcheck -lGL
    winsys/libwinsys.a(winsys-x11.o).gnu.linkonce.r._ZTI9WinSysX11[typeinfo for WinSysX11]+0x: undefined reference to `typeinfo for TWinSys'
    -----------

    I've organized my project using subdirectories (managed with autoconf). The winsys subdirectory will create a static library called libwinsys.a. Then this library is linked with the proper executable (and in the future a shared library).

    winsys subdirectory has:
    - winsys.h winsys.c (abstract class wich should be referenced for managing window system)
    - winsys-x11.h winsys.cpp (class derived from winsys.h, wich has implementation of virtual function declared in winsys.h for XFree86)

    Here is a part of the code of winsys.h:

    Code:
    #ifndef WINSYS_H
    #define WINSYS_H
    
    class TWinSys {
      public:
        ...
        virtual void GetDisplayGeometry();
        ...
    }
    
    #endif
    Here is a part of the code in winsys-x11.cpp:
    Code:
    #ifndef WINSYS_X11_H
    #define WINSYS_X11_H
    
    #include <winsys.h>
    
    class WinSysX11 : public TWinSys {
      private:
        ...
      public:
        ...
        void GetDisplayGeometry();
        ...
    }
    
    #endif
    Complete sources are available in the attachments...

    I hope someone helps!!!

    P.S: anyone can explain me how to handle correctly C++ exceptions? I must declare the exptions throwable in the function declaration? I have to define a basic exception class? And it's better to derive from it to report a specific error (like Java)? I'm a bit confused about error handling without error hanling, especially during constructors... (I've always programmed in C, so I've always used basic error reporting).
    Attached Files Attached Files
    When using Windows, have you ever told "Ehi... do your business?"
    Linux user #396597 (http://counter.li.org)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •