Skip to content

Error C2664 when compiling against Microsoft UWP platform #84

@wrobelda

Description

@wrobelda

When compiling against Microsoft UWP platform (both arm and x64), following error is reported:

C:\buildtrees\libofx\src\nfig_cmake-19dfe923fc.clean\lib\ofx_preproc.cpp(525): error C2664: 'DWORD GetModuleFileNameW(HMODULE,LPWSTR,DWORD)': cannot convert argument 2 from 'char [260]' to 'LPWSTR'
D:\buildtrees\libofx\src\nfig_cmake-19dfe923fc.clean\lib\ofx_preproc.cpp(525): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\libloaderapi.h(219): note: see declaration of 'GetModuleFileNameW'
ninja: build stopped: subcommand failed.

This was caught when preparing a PR adding a libofx portfile to vcpkg: microsoft/vcpkg#26864

One can reproduce that by checking out the branch this pulls from and running ./vcpkg install libofx:x64-uwp

A potential solution is discussed here: https://stackoverflow.com/questions/9754130/visual-cerror-c2664-getmodulefilenamew-cannot-convert-parameter-2-from

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions