Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [SOLVED]Linking a Static Libray
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Linking a Static Libray

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 3 Posters 1.4k 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.
  • W Offline
    W Offline
    wwolff
    wrote on last edited by
    #1

    Hi!

    I have a simple doubt:

    How can i link a compiled static library( with a .h and a .lib) files in my project?
    I use the option to include a static library and pass the paths ...etc...everything works file, but when i compile the code i receive erros like this one:
    main.obj : error LNK2019: unresolved external symbol "public: __cdecl CTerreno::CTerreno(void)" (??0CTerreno@@QEAA@XZ) referenced in function "void __cdecl `dynamic initializer for 'TrrExpl''(void)" (??__ETrrExpl@@YAXXZ)

    It seems Qt are not linking this methods , and i already run the qMake and rebuild the project , but with no results.

    Any help will be much appreciated.

    Kind Regards.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What kind of library is it ? C library ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • W Offline
        W Offline
        wwolff
        wrote on last edited by
        #3

        Yes, and when i recompile this with Qt (creating a libray) , when i link this library with my project, works fine...but

        when i use the original version of the lib (compiled in a old version of Msvc) , i receive this errors.
        Another strange behaviour is when i try open the .h of the old version of the lib, i receive an error telling Qt are having problems to open a not recognized UTF-8 File and ask for a conversion of the file type...This can generate this type of link problems?

        Kind Regards.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          [quote author="wwolff" date="1377384869"]Yes, and when i recompile this with Qt (creating a libray) , when i link this library with my project, works fine...but

          when i use the original version of the lib (compiled in a old version of Msvc) , i receive this errors.
          Another strange behaviour is when i try open the .h of the old version of the lib, i receive an error telling Qt are having problems to open a not recognized UTF-8 File and ask for a conversion of the file type...This can generate this type of link problems?

          Kind Regards.[/quote]

          Are you mixing compilers and versions?
          E.g. Qt libs compiled with msvc2010 and the other libs had been compiled with a previous version of msvc (or any permutation of compilers and versions)?

          You have to stay within the compiler and versions. you can mix only everything compiled with msvc2010 and everything compiled with msvc2012 and so on.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • W Offline
            W Offline
            wwolff
            wrote on last edited by
            #5

            Yes , i believe this is the problem, becouse this libray in the past was compiled with 2010 , but i´m using 2012 now, with Qt.
            Anyway, thanks so much for your help.
            Kind Regards.

            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