Thread: undefined symbol error during linnk time of library

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    22

    undefined symbol error during linnk time of library

    I have written some code. During run time it gives me this error

    Code:
    qgis: symbol lookup error: /usr/lib/qgis/libqgis_plugin_va.so: undefined symbol: _ZN12vARubberBandC1EP12QgsMapCanvas
    vARubberBand is a class and QgsMapCanvas is also a class.
    i am using a object of vARubberBand in another class x inheriting from QgsMapCanvas. Code looks clean to me, no warning at compile time but at runtime this error is presented.

    Help required to sort it out.

    regards
    quickNitin

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Check the spelling and types of function parameters.
    C++ overloading means that if you get the types even a little bit wrong, you get the wrong overloaded name generated compared to the one the library provides.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jul 2006
    Posts
    22

    ya found sth fishy

    thanks salem, i found in constructor i made a spelling mistake.

  4. #4
    Registered User
    Join Date
    Jul 2006
    Posts
    22

    error still persisting

    yesterday, i did corrections in code but agauin today found ,it is representing me with same error. Also i have a piece of code working on my machine . When i took that code to othe place and compiled it gave me similar error at runtime.

    I definitely needs some light thrown on this issue. What causes such symbol look up error in directory?
    Last edited by quickNitin; 09-01-2006 at 05:28 AM.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Can you be clear about whether this is a compile-time, link-time or run-time error.

    If you're linking with external libraries, check which versions you have.

    Post exact error messages where possible.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Jul 2006
    Posts
    22
    it is run time error which as per my understanding happening when dynamically linking to a library. Exact error is

    [ERROR]
    qgis: symbol lookup error: /usr/lib/qgis/libqgis_plugin_va.so: undefined symbol: _ZN12vARubberBandC1EP12QgsMapCanvas
    [/ERROR]

    Scenario is like this.
    I am working on open source gis QGis. For this i am writing a plugin. During compilation no warnings are issued. Application starts well. But as i do the event which bring control to my code it results in this error.

    What has becoming more frustrating is ,another plugin which was runnning well when i added to other machine resulted in similar error.

  7. #7
    Registered User
    Join Date
    Jul 2006
    Posts
    22
    i had figured out because of what error is thee but i dont know the answer.
    It slike that i am declaring a new class and proving implementation of it separate file. Whenever i want to create object of this type i am getting this error. If i comment out object creation everything falls in place. I think i have to mention somewhere this file may be in makefile but i am unable to find out.
    I am looking for guidance here. Above statement is an observation through trail and error method.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    If the function is being compiled into a library, then you may need to "install" the updated library in some way - say move it to /lib rather than leave it in the build directory.

    Check the makefile for say "make install" which should copy the library to it's proper run-time location.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Undefined Symbol error
    By Eavan Hyde in forum C++ Programming
    Replies: 3
    Last Post: 05-06-2004, 03:39 AM
  4. Undefined symbol 'stdprn'
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 07-03-2002, 02:05 PM
  5. I apologize. Good bye.
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 05-03-2002, 06:51 PM