[SOLVED]Linking a Static Libray



  • 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.


  • Lifetime Qt Champion

    Hi,

    What kind of library is it ? C library ?



  • 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.


  • Moderators

    [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.



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.