Results 1 to 2 of 2

Thread: Library Compilation issue

  1. #1
    Join Date
    Sep 2012
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Library Compilation issue

    Hello There,

    I am compiling gloox library in QT Creator. This library using "windns.h" header file. When i compile same library code in MSVC it compiled successfuly while in QT it always gives below error:

    ..\glooxlib\dns.cpp:176: error: no match for 'operator[]' in 'servers[pRec->_DnsRecord:ata._DnsRecord::<anonymous union>::SRV.DNS_SRV_DATA:NameTarget]'
    c:\qt\2010.04\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/stl_map.h:442: note: candidates are: _Tp& std::map<_Key, _Tp, _Compare, _Alloc>:perator[](const _Key&) [with _Key = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Tp = int, _Compare = std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, _Alloc = std::allocator<std:air<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> >]

    In code there is a function DnsQuery_UTF8 which comes from windns.h.
    windns.h is available in mingw. windns needs dnsapi.lib library, so i addedd it to .pro file.

    win32:LIBS += "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\DnsAPI.lib"

    But i am still getting same error message.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Library Compilation issue

    In short, you have a problem compiling (this is a compiler not linker error) a 3rd-party library using Windows API code with MingW. Nothing to do with Qt.

    The std::map has std::string keys and pNameTarget (LPTSTR) is is not std::string or something implicitly convertible. This may be a UNICODE/non-UNICODE issue, especially in light of the comments a few lines earlier in the source file.

Similar Threads

  1. Qt 3.3.5 compilation issue
    By bmahf in forum Installation and Deployment
    Replies: 0
    Last Post: 9th September 2011, 22:10
  2. VS 2005 CLR wrapper library error compilation C2182
    By soniaerm in forum Installation and Deployment
    Replies: 1
    Last Post: 28th April 2010, 16:48
  3. VS 2005 CLR wrapper library error compilation C2182
    By soniaerm in forum Qt Programming
    Replies: 0
    Last Post: 27th April 2010, 17:15
  4. Strange Compilation issue
    By NicholasSmith in forum Newbie
    Replies: 3
    Last Post: 4th September 2009, 15:40
  5. Unable to detect the library on QT compilation
    By rhonaldmoses in forum Newbie
    Replies: 1
    Last Post: 16th August 2008, 22:01

Tags for this Thread

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.