Results 1 to 3 of 3

Thread: Allocating memory for a windows structure

  1. #1
    Join Date
    Nov 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Allocating memory for a windows structure

    I am trying to allocate memory for a SP_DEVICE_INTERFACE_DATA structure.
    In a Windows based program using VS2008 I successfully used this:
    Qt Code:
    1. #include <windows.h>
    2. #include <winbase.h>
    3.  
    4. ...
    5.  
    6. SP_DEVICE_INTERFACE_DATA deviceinterface;
    7. SecureZeroMemory(&deviceinterface, sizeof(SP_DEVICE_INTERFACE_DATA));
    8.  
    9. ...
    To copy to clipboard, switch view to plain text mode 

    In QT 4 using netbeans 7.2.1 I am trying to use:
    Qt Code:
    1. #include <windows.h>
    2. #include <winbase.h>
    3.  
    4. ...
    5.  
    6. SP_DEVICE_INTERFACE_DATA devInterfaceInfo;
    7. devInterfaceInfo =
    8. (SP_DEVICE_INTERFACE_DATA)malloc(sizeof(SP_DEVICE_INTERFACE_DATA));
    9.  
    10. ...
    To copy to clipboard, switch view to plain text mode 

    In QT 4 I get the following error:
    QEnumerator.cpp:57: error: no matching function for call to '_SP_DEVICE_INTERFACE_DATA::_SP_DEVICE_INTERFACE_D ATA(void*)'
    c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/setupapi.h:722: note: candidates are: _SP_DEVICE_INTERFACE_DATA::_SP_DEVICE_INTERFACE_DA TA()
    c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/setupapi.h:722: note: _SP_DEVICE_INTERFACE_DATA::_SP_DEVICE_INTERFACE_DA TA(const _SP_DEVICE_INTERFACE_DATA&)
    I have successfully used the malloc() function in QT 4 for other structures and devtypes.
    Any help would be appreciated.

    Thanks
    DCM

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Allocating memory for a windows structure

    This is not a Qt problem but the gcc problem. Qt is only C++ library.

  3. #3
    Join Date
    Nov 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Allocating memory for a windows structure

    Thanks, Lesiok. I will look elsewhere.

    DCM

Similar Threads

  1. Allocating widgets on the stack verses using the heap
    By Ronayn in forum Qt Programming
    Replies: 3
    Last Post: 5th August 2011, 00:14
  2. Replies: 12
    Last Post: 26th June 2011, 11:26
  3. Replies: 7
    Last Post: 22nd September 2010, 00:32
  4. cc1plus.exe: out of memory allocating 65536 bytes
    By DirtyBrush in forum Qt Programming
    Replies: 4
    Last Post: 14th September 2009, 08:35
  5. Problems with allocating QSqlTableModel on heap
    By kosa in forum Qt Programming
    Replies: 1
    Last Post: 20th June 2009, 17:56

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.