首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为iOS编译OpenFST时出现类型转换错误

为iOS编译OpenFST时出现类型转换错误
EN

Stack Overflow用户
提问于 2018-01-11 04:27:22
回答 1查看 269关注 0票数 1

我正在尝试为iOS编译OpenFST,这就是make失败的地方:

代码语言:javascript
复制
cd openfst-1.6.5/src/lib
/Applications/Xcode.app/Contents/Developer/usr/bin/g++ 
  -DHAVE_CONFIG_H 
  -I./../include 
  -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/c++/4.2.1/ 
  -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/ 
  -miphoneos-version-min=8.1 
  -arch armv7 
  -fno-exceptions 
  -funsigned-char 
  -pipe 
  -no-cpp-precomp 
  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk 
  -std=c++11 
  -MT compat.lo -MD -MP -MF .deps/compat.Tpo -c compat.cc -o compat.o

它抛出了许多类似的错误,就像这样

代码语言:javascript
复制
/../iPhoneOS.sdk/usr/include/c++/4.2.1/cwchar:212:12: 
  error: cannot initialize return object of type
  'wchar_t *' with an rvalue of type 'const wchar_t *'
{ return wcschr(const_cast<const wchar_t*>(__p), __c); }
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/../iPhoneOS.sdk/usr/include/c++/4.2.1/cwchar:218:12: 
  error: cannot initialize return object of type
  'wchar_t *' with an rvalue of type 'const wchar_t *'
{ return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/../usr/include/c++/v1/tuple:1352:22: 
error: C++ requires a type specifier for all declarations
pair<_T1, _T2>::pair(piecewise_construct_t,
                     ^
/../usr/include/c++/v1/tuple:1351:1: 
error: declarator requires an identifier
inline _LIBCPP_INLINE_VISIBILITY
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

我觉得我在这里使用了错误的c++版本还是怎么的?

EN

回答 1

Stack Overflow用户

发布于 2018-01-12 23:04:26

如果回溯中的c++/4.2.1指的是GCC 4.2.1,那么这是一个非常古老的编译器套件(11岁)。OpenFst自述文件称需要使用GCC 4.7或更高版本。(这可能是为了支持C++11和C99。)我不知道如何将XCode版本映射到Clang编译器版本(以及哪些Clang版本对C++11有实质性支持),但我想这在某个地方有文档记录。

正如我们所说的那样,我正在Linux + armv7 + GCC 5.4.0 (一个廉价的Chromebook + Crouton)上运行OpenFst,所以我怀疑ARM支持是问题所在。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48195533

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档