Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error C2664 when compiling against Microsoft UWP platform #84

Open
wrobelda opened this issue Sep 18, 2022 · 2 comments · May be fixed by #91
Open

Error C2664 when compiling against Microsoft UWP platform #84

wrobelda opened this issue Sep 18, 2022 · 2 comments · May be fixed by #91

Comments

@wrobelda
Copy link
Collaborator

wrobelda commented Sep 18, 2022

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

@wrobelda wrobelda changed the title Error C2664 when compiling against UWP platform Error C2664 when compiling against Microsoft UWP platform Sep 18, 2022
@cstim
Copy link
Member

cstim commented Sep 19, 2022

Feel free to also add a "github action for building on windows", so that these build failures are caught in the CI pipeline already...

@cstim
Copy link
Member

cstim commented Oct 3, 2022

From the stackoverflow question I gathered we might need to call the function with an A suffix. See the branch I created.

@cstim cstim linked a pull request Oct 3, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants