Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error: undefined reference to '_imp___ZN8BamTools9BamReaderC1Ev', when using BamTools library:
Forum Updated to NodeBB v4.3 + New Features

Error: undefined reference to '_imp___ZN8BamTools9BamReaderC1Ev', when using BamTools library:

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    edtasker
    wrote on last edited by
    #1

    I want to use the BamTools API in my qt project. I am using Qt5.2 on Windows 7.

    I downloaded and made the BamTools library following the instructions at https://github.com/pezmaster31/bamtools/wiki/Building-and-installing

    In the BamTools/lib directory i have the files: "libbamtools-utils.a"; "libjsoncpp.a"; "libbamtools.a";
    "libbamtools.dll"; and "libbamtools.dll.a".

    In my .pro file i have the following:
    @
    LIBS += -L$$PWD/../../BamTools/lib/ -llibbamtools

    INCLUDEPATH += $$PWD/../../BamTools/include
    DEPENDPATH += $$PWD/../../BamTools/include
    @

    When I try to create a BamReader object in one of my .cpp files, i get the error: undefined reference to '_ imp___ZN8BamTools9BamReaderC1Ev'.

    I have no idea how to fix this sort of error and have been searching the internet for something but cant find anything relavant. This is the first time I have tried to use a library in a Qt project, so I'm not sure if I'm doing that wrong or there's something wrong with the library I made. Any help would be much appreciated.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      What compiler do you use? VisualStudio or MinGW.

      I'm not sure about VS, for MinGW I think it should be
      @
      LIBS += -L$$PWD/../../BamTools/lib/ -lbamtools
      @

      Note -lbamtools without lib.

      1 Reply Last reply
      0
      • E Offline
        E Offline
        edtasker
        wrote on last edited by
        #3

        andreyc, I still get the same error when I use '-lbamtools'.

        Good question about which compiler, actually I tried both MinGW and VS and I get the same error with both.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andreyc
          wrote on last edited by
          #4

          I don't think this error is related to Qt.

          The undefined symbol _ imp___ZN8BamTools9BamReaderC1E is a C++ mangled name for BamTools::BamReader::BamReader()

          Check if you build library correctly.
          If you have an utility nm with MinGW then you can use it
          @
          nm -C libbamtools.so|grep BamReader
          @

          Create a simple example that uses bamtool without Qt and try to build it with the libbamtools. It may help to investigate the problem.

          Another idea, don't mix libraries build with MinGW and VS.
          Use only one tool for all your libs and apps.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved