Results 1 to 8 of 8

Thread: Qt and the Loki Library

  1. #1
    Join Date
    Aug 2008
    Posts
    12
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt and the Loki Library

    We are using Qt and the Loki library with a program and cannot get a succesfule link with MS Visual C++ 2005. There is no problem, however, linking and executing the program under Linux.

    We use many QT functions and classes, but only the SafeFormat functions from Loki. The compiler error message is:

    1>x.obj : error LNK2019: unresolved external symbol
    1>"void __cdecl Loki::_write(class std::basic_ostream<char,struct
    1>std::char_traits<char> > &,char const *,char const *)"
    1>(?_write@Loki@@YAXAAV?$basic_ostream@DU?$char_tr aits@D@std@@@std@@PBD1
    1>@Z) referenced in function "private: void __thiscall
    1>Loki::PrintfState<class std::basic_ostream<char,struct
    1>std::char_traits<char> > &,char>::Write(char const *,char const *)"
    1>(?Write@?$PrintfState@AAV?$basic_ostream@DU?$cha r_traits@D@std@@@std@@
    1>D@Loki@@AAEXPBD0@Z)

    1>x.obj : error LNK2019: unresolved external symbol
    1>"void __cdecl Loki::_write(struct _iobuf *,char const *,char const *)"
    1>(?_write@Loki@@YAXPAU_iobuf@@PBD1@Z) referenced in function "private:
    1>void __thiscall Loki::PrintfState<struct _iobuf *,char>::Write(char
    1>const *,char const *)"
    1>(?Write@?$PrintfState@PAU_iobuf@@D@Loki@@AAEXPBD 0@Z)

    We have double checked our paths for includes and finding
    the loki.lib.

    We have also tried adding the Loki source file and header for SafeFormat to our program solution but get the same errors.

    We would like to use loki.lib under Windows but can't get past this.

    Thanks for any help.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt and the Loki Library

    Could you verify the linker command arguments that the loki library indeed is getting linked with the executable?

  3. The following user says thank you to wysota for this useful post:

    tbrowder (15th August 2008)

  4. #3
    Join Date
    Aug 2008
    Posts
    12
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt and the Loki Library

    Thanks for the response. We confirmed it as best we can.

    As we said, we also added the source and header files to our project and ignored the library but got the same error.

    We have have looked into low-level Qt headers and MS C library headers to see if we can find a clue. Not long ago we found that some programs with Loki and Qt have no problem, so we may be missing a library somewhere.

    The hunt goes on...

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt and the Loki Library

    Are you sure the Loki lib is compiled for MSVC and not MinGW? Do you have a corresponding dll file, by the way?

  6. The following user says thank you to wysota for this useful post:

    tbrowder (15th August 2008)

  7. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Qt and the Loki Library

    Also, does the library have necessary import/export macros for its public classes?
    J-P Nurmi

  8. The following user says thank you to jpn for this useful post:

    tbrowder (15th August 2008)

  9. #6
    Join Date
    Aug 2008
    Posts
    12
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt and the Loki Library

    We used the MSVC solution for 2005 that came with the library. It produces a static library (.lib).

    Note that we get the same errors if we drop the source and header files into our program source and do not link with the library.

    It has been suggested that _write may be a Qt macro that is somehow confusing the linker. We do know that Qt has a QT_WRITE macro but are not sure how that works in the IO system.

  10. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt and the Loki Library

    This is "Loki::_write" and not "_write". If the name "_write" is reported by the linker, it is not a macro as macros are expanded by the preprocessor. Check if your Loki library indeed has the referenced symbol (Loki::_write) in it.

  11. #8
    Join Date
    Aug 2008
    Posts
    12
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt and the Loki Library

    Thanks--we'll see.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.