Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [SOLVED] Problem adding an external library to QtCreator

    General and Desktop
    2
    7
    1923
    Loading More Posts
    • 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.
    • B
      blueblood last edited by

      Hi there,

      I have those 2 lines in my .pro file :

      @INCLUDEPATH += C:/Users/username/Downloads/Compressed/id3lib-3.8.3/id3lib-3.8.3/include

      LIBS += LC:/Users/username/Downloads/Compressed/id3lib-3.8.3binaries/id3lib-3.8.3binaries/Debug -lid3lib
      @

      The includes are found all right with auto-completion. When linking, I get this:

      LNK1104: cannot open file 'C:/Users/userame/Downloads/Compressed/id3lib-3.8.3binaries/id3lib-3.8.3binaries/Debug.obj'

      I have no idea what QtCreator is after here.

      1 Reply Last reply Reply Quote 0
      • T
        tilsitt last edited by

        Hi,

        your LIBS line miss a '-' in front of 'L':

        @
        LIBS += -LC:/Users/username/Downloads/Compressed/id3lib-3.8.3binaries/id3lib-3.8.3binaries/Debug -lid3lib
        @

        1 Reply Last reply Reply Quote 0
        • B
          blueblood last edited by

          thanks.

          I applied the dash as suggested and now I get unresolved externals for all the library methods I use.

          Example:

          LNK2019: unresolved external symbol "public: class ID3_Field * __cdecl ID3_Frame::GetField(enum ID3_FieldID)const " (?GetField@ID3_Frame@@QEBAPEAVID3_Field@@W4ID3_FieldID@@@Z) referenced in function "private: char const * __cdecl Song::_fieldNameFromFrame(class std::shared_ptr<class ID3_Frame>)const " (?_fieldNameFromFrame@Song@@AEBAPEBDV?$shared_ptr@VID3_Frame@@@std@@@Z)

          1 Reply Last reply Reply Quote 0
          • T
            tilsitt last edited by

            Ok, now it's not about Qt anymore. The compiler says it: your lib doesn't contain the symbols. I guess C:/Users/username/Downloads/Compressed/id3lib-3.8.3binaries/id3lib-3.8.3binaries/Debug contains a file called id3lib.lib? Did you compile it yourself? Is it a static or shared library?

            1 Reply Last reply Reply Quote 0
            • B
              blueblood last edited by

              Thanks. It contains that file, and I didn't compile it myself, I downloaded it. I'm trying to link it statically using this preprocessor directive:

              ID3LIB_LINKOPTION=1

              1 Reply Last reply Reply Quote 0
              • B
                blueblood last edited by

                I don't know, but the same method calls from id3lib in visual studio work just fine. The problem is, I can't find the visual studio addin installer anymore, to develop in VS instead.

                1 Reply Last reply Reply Quote 0
                • B
                  blueblood last edited by

                  So I installed the "Visual Studio addin":http://ftp.fau.de/qtproject/official_releases/vsaddin/qt-vs-addin-1.2.3-opensource.exe, which highlighted that I was using 64-bit Qt for a 32-bit build:

                  module machine type 'x64' conflicts with target machine type 'X86' ...\Qt5Cored.lib(Qt5Cored.dll).

                  So I downloaded the 32-bit Qt and rebuilt and it seems to compile fine.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post