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 when building in Windows #45

Open
anhthoai opened this issue Jun 14, 2023 · 4 comments
Open

Error when building in Windows #45

anhthoai opened this issue Jun 14, 2023 · 4 comments

Comments

@anhthoai
Copy link

image
Hello @shaoshengsong, I have tried to build in Windows, but there is error as screenshot, I don't know why. I can't see any error at that line. Could you please help me on that?

@anhthoai
Copy link
Author

This is information:
image

@yuanry16
Copy link

May I ask how it was resolved?

@Yuan262
Copy link

Yuan262 commented Jan 24, 2024

解决了吗?老哥

@YangSangWan
Copy link

YangSangWan commented Mar 14, 2024

May I ask how it was resolved? plz...

ok... i solved it!!

in windows. Ort::Session 's second parameter is "const wchar_t*"

we need to make function stringToWString

edit FeatureTensor.h

Ort::Session session_{env, k_feature_model_path.c_str(), Ort::SessionOptions{nullptr}};

to

#include <windows.h>

std::wstring stringToWString(const std::string& str) {
    if (str.empty()) return std::wstring();

    int sizeNeeded = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);
    std::wstring wstrTo(sizeNeeded, 0);
    MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &wstrTo[0], sizeNeeded);
    return wstrTo;
}
Ort::Session session_{env, stringToWString(k_feature_model_path).c_str(), Ort::SessionOptions{nullptr}};

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

No branches or pull requests

4 participants