Results 1 to 4 of 4

Thread: [Win] Problems with PIP_ADAPTER_ADDRESSES

  1. #1
    Join Date
    Jun 2008
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [Win] Problems with PIP_ADAPTER_ADDRESSES

    Hi all,
    I`m brand-new Qt programmer. I`ve written my first serious program. It is a kind of network monitor, very simple just shows basic informations such as IP, Broadcast etc. On Linux it works correctly but on Windows I get the GUID numbers in QComboBox (on Linux of course there are names like a "eth0" or "lo"). I decided to use some WinAPI functions to convert this numbers to normal ASCII name. But of course now I have some problems with my source code. When I fire up "make" i get this message:
    Qt Code:
    1. qip.h:77: error: `PIP_ADAPTER_ADDRESSES` does not a name of type
    To copy to clipboard, switch view to plain text mode 

    I don`t know what is wrong. This is my source code:
    File: qip.h
    http://paste.org/index.php?id=3096

    File: qip.cpp
    http://paste.org/index.php?id=3097

    And this is the QIP.pro file:
    Qt Code:
    1. ######################################################################
    2. # Automatically generated by qmake (2.01a) Cz 19. cze 15:49:43 2008
    3. ######################################################################
    4.  
    5. TEMPLATE = app
    6. TARGET =
    7. DEPENDPATH += . release
    8. INCLUDEPATH += .
    9.  
    10. # Input
    11. HEADERS += qip.h \
    12. c:\mingw\include\iphlpapi.h \
    13. c:\mingw\include\winsock2.h
    14. FORMS += qip.ui
    15. SOURCES += main.cpp qip.cpp
    16. RESOURCES += qipresources.qrc
    17. TRANSLATIONS += trans_pl.ts
    18. QT += network
    19. RC_FILE = qip_resource.rc
    To copy to clipboard, switch view to plain text mode 

    I don`t sure that my idea was good. Maybe there is more convenient and smart way
    Regards,
    Bartek

  2. #2
    Join Date
    Jun 2008
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [Win] Problems with PIP_ADAPTER_ADDRESSES

    Ok guys I was trying to fix up this problem, but realised that it is impossible to connect Qt with functions from <iphlpapi.h> maybe with WinAPI at all

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [Win] Problems with PIP_ADAPTER_ADDRESSES

    you should take a look at this: http://msdn.microsoft.com/en-us/libr...15(VS.85).aspx.

    You can use WinAPI code in a Qt application without problems.
    PIP_ADAPTER_ADDRESSES is a pointer to IP_ADAPTER_ADDRESSES...maybe you don;t have that defined.

    Anyway, QNetworkInterface already contains the support for getting all the interfaces, although it does not seem to return their friendly names on Windows. For this purpose you can use GetAdaptersAddresses.

  4. #4
    Join Date
    Jun 2008
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [Win] Problems with PIP_ADAPTER_ADDRESSES

    I`ve already known that, I should use this function from MSDN, but I have troubles during working with this function. Ok now I changed PIP_ADAPTER_ADDRESSES to "struct IP_ADAPTER_ADDRESSES* " and I have following errors:
    Qt Code:
    1. qip.cpp: In member function `void QIP::createNetworkList()':
    2. qip.cpp:57: error: `AF_UNSPEC' undeclared (first use this function)
    3. qip.cpp:57: error: (Each undeclared identifier is reported only once for each fu
    4. nction it appears in.)
    5. qip.cpp:57: error: `GAA_FLAG_INCLUDE_PREFIX' undeclared (first use this function
    6. )
    7. qip.cpp:57: error: `GetAdaptersAddresses' undeclared (first use this function)
    8. qip.cpp:57: error: `ERROR_BUFFER_OVERFLOW' undeclared (first use this function)
    9. qip.cpp:59: error: `GetProcessHeap' undeclared (first use this function)
    10. qip.cpp:59: error: `HeapFree' undeclared (first use this function)
    11. qip.cpp:60: error: `HeapAlloc' undeclared (first use this function)
    12. qip.cpp:62: error: `NO_ERROR' undeclared (first use this function)
    13. qip.cpp:68: error: invalid use of undefined type `struct IP_ADAPTER_ADDRESSES'
    14. qip.h:77: error: forward declaration of `struct IP_ADAPTER_ADDRESSES'
    15. qip.cpp:69: error: invalid use of undefined type `struct IP_ADAPTER_ADDRESSES'
    16. qip.h:77: error: forward declaration of `struct IP_ADAPTER_ADDRESSES'
    17. mingw32-make[1]: *** [release/qip.o] Error 1
    18. mingw32-make[1]: Leaving directory `C:/Documents and Settings/Bartek/Moje dokume
    19. nty/0.2'
    20. mingw32-make: *** [release] Error 2
    21.  
    22. C:\Documents and Settings\Bartek\Moje dokumenty\0.2>
    To copy to clipboard, switch view to plain text mode 
    I really don`t know what is going on. It seems to doesn`t know anything about declarations from iphlpapi.h and winsock2.h.

Similar Threads

  1. flicker and wierd resize problems ...
    By momesana in forum Qt Programming
    Replies: 1
    Last Post: 12th May 2008, 18:00
  2. canonicalFilePath() thread problems
    By magland in forum Qt Programming
    Replies: 10
    Last Post: 5th December 2007, 21:22
  3. Few general problems
    By Salazaar in forum Newbie
    Replies: 9
    Last Post: 13th June 2007, 22:44
  4. Replies: 2
    Last Post: 8th March 2007, 22:22
  5. QT4 Plugins - problems, problems
    By NormanDunbar in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 15:39

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.