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

使用mingw32编译TNN,遇到一点小瑕疵错误,可以修正一下 #1529

Closed
sxj731533730 opened this issue Jan 18, 2022 · 1 comment
Closed

Comments

@sxj731533730
Copy link
Contributor

sxj731533730 commented Jan 18, 2022

我使用mingw32 编译器,编译过程中遇到一点小瑕疵错误,因为mingw32仍然需要命名空间支持
[ 99%] Building CXX object CMakeFiles/TNN.dir/source/tnn/utils/split_utils.cc.obj
D:\TNN\source\tnn\utils\split_utils.cc: In static member function 'static tnn::Status tnn::SplitUtils::SplitStr(const char*, tnn::str_arr&, const char*, bool, bool, bool, bool, bool)':
D:\TNN\source\tnn\utils\split_utils.cc:163:23: error: 'min' was not declared in this scope
int len = min((i - cursor), subs_length - 1);

所以我修改为三目运算符,感觉好一点
#if defined(WIN32) && _MSC_VER < 1300 // VC++ 6.0
//int len = min((i - cursor), subs_length - 1);
int len = (i - cursor)>=(subs_length - 1)?(subs_length - 1):(i - cursor);
#else
int len = std::min(i - cursor, subs_length - 1);
#endif

仅建议

@neiltian-tencent
Copy link
Collaborator

#1528 已合入

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

2 participants