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

Visual Studio Compile Fail when Unicode Enabled: CreateFile() Requires LPCWSTR File Name #213

Open
AMZN-Gene opened this issue Dec 3, 2024 · 1 comment · May be fixed by #214
Open

Visual Studio Compile Fail when Unicode Enabled: CreateFile() Requires LPCWSTR File Name #213

AMZN-Gene opened this issue Dec 3, 2024 · 1 comment · May be fixed by #214
Labels
enhancement New feature or request

Comments

@AMZN-Gene
Copy link

AMZN-Gene commented Dec 3, 2024

tinyusdz_static fails to compile due to CreateFile resolves to CreateFileW needing wide-character string

Repro Steps
OS: Windows
Compiler: MSVC Visual Studio 2022

  1. Update TinyUSDZ cmake for a project supporting other languages by adding add_compile_definitions(UNICODE)
  2. Compile tinyusdz_static with UNICODE macro enabled

Results

1>D:\tinyusdz_repo-src\src\io-util.cc(158,7): error C2664:         with
1>D:\tinyusdz_repo-src\src\io-util.cc(158,7): error C2664:         [
1>D:\\tinyusdz_repo-src\src\io-util.cc(158,7): error C2664:             _Elem=char
1>D:\\tinyusdz_repo-src\src\io-util.cc(158,7): error C2664:         ]
1>    D:\\tinyusdz_repo-src\src\io-util.cc(158,32):
1>    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
1>    C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\fileapi.h(92,1):
1>    see declaration of 'CreateFileW'
1>    D:\\tinyusdz_repo-src\src\io-util.cc(158,7):
1>    while trying to match the argument list '(const _Elem *, unsigned long, int, nullptr, int, int, nullptr)'
1>        with
1>        [
1>            _Elem=char
1>        ]
1>Done building project "tinyusdz_static.vcxproj" -- FAILED.
@AMZN-Gene AMZN-Gene changed the title Visual Studio Compile Fail: CreateFile() Requires LPCWSTR File Name Visual Studio Compile Fail when Unicode Enabled: CreateFile() Requires LPCWSTR File Name Dec 3, 2024
@syoyo
Copy link
Collaborator

syoyo commented Dec 3, 2024

Unicode build on Windows(UTF16LE) is not well tested and maintained.

You can contribute Unicode + MSVC build support! PR is much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants