Results 1 to 5 of 5

Thread: Qt application Compiling with ATL library Plroblem

  1. #1
    Join Date
    Mar 2011
    Posts
    2
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Smile Qt application Compiling with ATL library Plroblem

    Hello ,
    I am getting problem in compiling ATL project with Qt application.

    I m getting below errors

    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlbase.h(5086) : error C2664: 'ATL::CRegKey::QueryStringValue' : cannot convert parameter 2 from 'TCHAR [64]' to 'LPTSTR'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlbase.h(5095) : error C2664: 'T2OLE_EX' : cannot convert parameter 1 from 'TCHAR [64]' to 'LPTSTR'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlbase.h(5261) : error C2664: 'RegEnumKeyExW' : cannot convert parameter 3 from 'TCHAR [256]' to 'LPWSTR'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlbase.h(5261) : fatal error C1903: unable to recover from previous error(s); stopping compilation

    Could anyone please help me out.

    Thanks in Advance
    Srikant

  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: Qt application Compiling with ATL library Plroblem

    The errors are because you are passing incompatible data to the respective routines. It is not immediately obvious how you arrive at these specific errors. Since you don't bother to show us the lines in your code that triggered these messages we cannot really help.

    If you still cannot nut it out, and since this has nothing to do with Qt, you are better off looking for Microsoft and ATL resources and forums:
    http://msdn.microsoft.com/en-us/libr...=VS.90%29.aspx
    http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx
    http://groups.google.com/group/micro....vc.atl/topics
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

  3. #3
    Join Date
    Mar 2011
    Posts
    2
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Qt application Compiling with ATL library Plroblem

    Hi , Thank you for your reply. But i'm trying to build few files in a new solution. The problem is that i have added these files in a new solution and on trying to build it, iam getting these errors. Though what i found is that few of these files have ATl dependency. But i was not able to find out what is causing this error. Actually this error is coming on compilation of a file, which on checking out i found that it has no dependecy with ATL. You can find few more description:

    1) The project is in QT
    2) I am trying to put certain files which actually has ATl dependency into a new solution.

  4. #4
    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: Qt application Compiling with ATL library Plroblem

    The error is caused by the code you added to your project. You are not showing the code so we have no hope of correcting the error. It could be simple as compiling with/without the UNICODE/_UNICODE defines or it may be just broken code.

    The error is clearly caused by passing improper arguments to an MFC or ATL class, or Windows API calls. The original cpp file must, therefore, have a dependency on MFC, ATL and Windows API headers/classes whether you intended it to or not. The particular methods are:
    Qt Code:
    1. // From ATL
    2. LONG QueryStringValue(
    3. LPCTSTR pszValueName,
    4. LPTSTR pszValue,
    5. ULONG* pnChars
    6. ) throw( );
    7.  
    8. // From Windows API (the Wide version of this)
    9. LONG WINAPI RegEnumKeyEx(
    10. __in HKEY hKey,
    11. __in DWORD dwIndex,
    12. __out LPTSTR lpName,
    13. __inout LPDWORD lpcName,
    14. __reserved LPDWORD lpReserved,
    15. __inout LPTSTR lpClass,
    16. __inout_opt LPDWORD lpcClass,
    17. __out_opt PFILETIME lpftLastWriteTime
    18. );
    To copy to clipboard, switch view to plain text mode 

    The project might have Qt components but the problem is not related to Qt.


    Added after 6 minutes:


    Does your code around the first call look anything like this?
    Qt Code:
    1. ATL::CRegKey regkey(...);
    2. TCHAR somebuffer[64];
    3. LONG nChars = 64;
    4. ...
    5. LONG ret = regkey.QueryStringValue("valuename", *somebuffer, &nChars);
    To copy to clipboard, switch view to plain text mode 
    If so, drop the asterisk in the method arguments.
    Last edited by ChrisW67; 11th May 2011 at 10:13.

  5. #5
    Join Date
    Sep 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Qt application Compiling with ATL library Plroblem

    I ran into this problem also. In my .pro file I had set:

    win32: CharacterSet=2

    I did this to enable multi-byte character set in my Visual Studio project. However, this does not remove the "UNICODE" preprocessor directive from the project. You have to remove it manually by doing this:

    win32: DEFINES -= UNICODE

    Normally I wouldn't set a Qt project to multi-byte, but I was trying to get a small unit test project going with some existing code that was dependent on multi-byte character set.

Similar Threads

  1. Replies: 2
    Last Post: 8th July 2010, 08:10
  2. Compiling QCA as static library
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 7th December 2008, 18:32
  3. Having problems compiling QtXmlPatternsd library
    By zorro68 in forum Installation and Deployment
    Replies: 2
    Last Post: 26th May 2008, 07:53
  4. Help compiling Qt4 Application
    By drake1983 in forum Newbie
    Replies: 4
    Last Post: 15th November 2007, 15:32
  5. Replies: 5
    Last Post: 26th June 2007, 14:10

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.