原文连接地址:http://blog.csdn.net/believenow_notfuture/article/details/52191229

【转】SAPI 包含sphelper.h编译错误解决方案 在使用Microsoft Speech SDK 5.1开发语音识别程序时,包含了头文件“sphelper.h”和库文件“sapi.lib”。编译时出错: 1>c:/program files/microsoft speech sdk 5.1/include/sphelper.h(769) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:/program files/microsoft speech sdk 5.1/include/sphelper.h(1419) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:/program files/microsoft speech sdk 5.1/include/sphelper.h(2373) : error C2065: 'psz' : undeclared identifier 1>c:/program files/microsoft speech sdk 5.1/include/sphelper.h(2559) : error C2440: 'initializing' : cannot convert from 'CSpDynamicString' to 'SPPHONEID *' 1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called 1>c:/program files/microsoft speech sdk 5.1/include/sphelper.h(2633) : error C2664: 'wcslen' : cannot convert parameter 1 from 'SPPHONEID *' to 'const wchar_t *' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 搜索了一圈,根据大家的经验汇总,应该是Speech代码编写时间太早,语法不严密。而VS2005对于语法检查非常严格,导致编译无法通过。修改头文件中的以下行即可正常编译:

  1. Ln 769 const ulLenVendorPreferred = wcslen(pszVendorPreferred);
  2.  
  3. const unsigned long ulLenVendorPreferred = wcslen(pszVendorPreferred);
  4.  
  5. Ln 1418 static CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX)
  6.  
  7. static HRESULT CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX)
  8.  
  9. Ln 2372 for (const WCHAR * psz = (const WCHAR *)lParam; *psz; psz++) {}
  10.  
  11. const WCHAR * psz; for (psz = (const WCHAR *)lParam; *psz; psz++) {}
  12.  
  13. Ln 2559 SPPHONEID* pphoneId = dsPhoneId;
  14.  
  15. SPPHONEID* pphoneId = (SPPHONEID*)((WCHAR *)dsPhoneId);
  16.  
  17. Ln 2633 pphoneId += wcslen(pphoneId) + 1;
  18.  
  19. pphoneId += wcslen((const wchar_t *)pphoneId) + 1;

好了,编译通过,下面可以正式编写程序逻辑了。

SAPI 包含sphelper.h编译错误解决方案的更多相关文章

  1. (转载)SAPI 包含sphelper.h编译错误解决方案

    [转]SAPI 包含sphelper.h编译错误解决方案 在使用Microsoft Speech SDK 5.1开发语音识别程序时,包含了头文件“sphelper.h”和库文件“sapi.lib”.编 ...

  2. Cocos2dx 代码中包含中文导致编译错误的问题解决方法

    从网上下载一个cocos2dx的源码,是IOS版本的,我将其迁移到windows 7下 ,用VS2010编译,出现一堆的C2001错误: 1>d:\cocos2d-x-2.2.6\mygame\ ...

  3. because it is not a variable 编译错误解决方案

    1,将Stuct换为class 2,使用中间变量, 如Point p=new Point(x,y); this.Location=p; 而不能直接给struct赋值,因为值类型是不能改变的,必须生成新 ...

  4. centos type.h 编译错误问题

    # ifndef __int8_t_defined # define __int8_t_defined __intN_t (, __QI__); __intN_t (, __HI__); __intN ...

  5. VS2010编译错误:是否忘记了向源中添加“#include "stdafx.h

    VS2010编译错误:是否忘记了向源中添加“#include "stdafx.h 编译提示:fatal error C1010: 在查找预编译头时遇到意外的文件结尾.是否忘记了向源中添加“# ...

  6. php源码编译常见错误解决方案大全

    php源码编译常见错误解决方案大全http://www.cnlvzi.com/index.php/Index/article/id/143 在CentOS编译PHP5的时候有时会遇到以下的一些错误信息 ...

  7. Caffe 工程的一些编译错误以及解决方案

    本系列文章由 @yhl_leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/51371936 整理一下最近遇到caff ...

  8. 【Redis】编译错误zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory

    [Redis]编译错误zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory 在安装redis进行编译 ...

  9. VS2008编译错误:error C2065: 'PMIB_TCPSTATS' : undeclared identifier c:\program files (x86)\microsoft sdks\windows\v7.0a\include\iphlpapi.h 411

    安装了VS2008编译之前的程序,结果出现了编译错误,以为是VS2008的Sp1补丁没装好,重装补丁后还是不行,编译错误如下: 双击错误会定位在iphlpapi.h中, 一个可行的解决办法是:把iph ...

随机推荐

  1. 仿京东淘宝商品详情页属性选择js效果

    在网上找了好久发现都不符合要求就自己摸索写了一个,用到了linq.js这个linq to js 扩展,不然用纯JS遍历json查询要死人啊 demo:http://123.207.28.46:8086 ...

  2. Visual Studio 智能提示功能消失解决办法

    步骤如下: 开始菜单 -->所有程序-->Visual Studio 2012文件夹 --> Visual Studio Tools --> Developer Command ...

  3. SSH项目中的困惑之一

    1.request.getContextPath()详解 <%=request.getContextPath()%>是为了解决相对路径的问题,可返回站点的根路径. 但不用也可以,比如< ...

  4. git学习笔记(一)——从已存在的远程仓库克隆

    应用场景:在公司电脑把脚本上传到公司的gitlab上,在家里想继续写: 问题: 家里的之前代码连的是github的仓库,需要把公钥替换成公司gitlab的. 环境:win10,pycharm,git ...

  5. POJ 3046

    题目大意:蚂蚁牙黑,蚂蚁牙红:有A只蚂蚁,来自T个家族,分别记为ant[i]个.同一个家族的蚂蚁长得一样,但是不同家族的蚂蚁牙齿颜色不同.任取n只蚂蚁(S <= n <= B),求能组成几 ...

  6. Django创建App报错

    在django下创建APP项目时遇到的坑 python manage.py startapp app01 报错内容如下: 解决:找到报错中的文件夹151行删除items(),)中的逗号即可 在命令行下 ...

  7. 【递归入门】组合+判断素数:dfs(递归)

    题目描述 已知 n 个整数b1,b2,…,bn,以及一个整数 k(k<n).从 n 个整数中任选 k 个整数相加,可分别得到一系列的和. 例如当 n=4,k=3,4 个整数分别为 3,7,12, ...

  8. [leetcode-738-Monotone Increasing Digits]

    Given a non-negative integer N, find the largest number that is less than or equal to N with monoton ...

  9. C语言 内存分配 地址 指针 数组 参数 实例解析

    . Android源码看的鸭梨大啊, 补一下C语言基础 ... . 作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article/detai ...

  10. Internet History,Tecchnology and Security

    Internet History Internet Technologe Internet Secure