Need help to compile 64-bit code
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Need help to compile 64-bit code

  1. #1
    Join Date
    Jun 2010
    Posts
    136

    Need help to compile 64-bit code

    Hi,
    I need help to compile our code using 64-bit compiler. Our software code has been compiled using Visual Studio Win32 compiler. But when I tried to compile using windows x64 compiler I get lot of errors. For example,

    I get error that GCL_HBRBACKGROUND is undefined but it runs fine on windows 32 compiler. I might need to use GCLP_HBRBACKGROUND to compile correctly on x64 compiler.

    So, my question is that is there any way that I can compile the same code or with using macros such as

    #ifdef _Win64
    #endif

    on both Win32 and x64 compiler instead of having different copies of code, one for Win32 and one for x64.

    Any help would be really appreciated.

    Regards,
    ABM

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,011

    Re: Need help to compile 64-bit code

    I guess, MSFT has already done all these
    Code:
    #ifdef _Win64 
    #endif
    for you. So you only have to use proper definitions for both Win32 and x64 compilers such as GCLP_HBRBACKGROUND instead of GCL_HBRBACKGROUND,
    SetClassLongPtr instead of SetClassLong,
    ...
    DWORD_PTR instead of DWORD,
    ULONG_PTR instead of ULONG,
    and so on...
    Last edited by VictorN; July 18th, 2012 at 08:38 AM.
    Victor Nijegorodov

  3. #3
    Join Date
    Jun 2010
    Posts
    136

    Re: Need help to compile 64-bit code

    Thanks Victor for your reply. If I use 64-bit datatypes such as DWORD_PTR, ULONG_PTR will I have to change code back to DWORD when I will compile under Win32 compiler ?

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,011

    Re: Need help to compile 64-bit code

    No! In Win32 DWORD_PTR is the same as DWORD. And so on...
    Victor Nijegorodov

  5. #5
    Join Date
    Jun 2010
    Posts
    136

    Re: Need help to compile 64-bit code

    Thanks Victor.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center