编译cvaux错误的原因

引用:   http://www.cnblogs.com/oskycar/archive/2009/08/30/1556920.html

VS2013 

在debug模式下编译cvaux时会提示三个错误:

error C2039: 'foreground_regions' : is not a member of 'CvFGDStatModel'

error C2039: 'foreground_regions' : is not a member of 'CvFGDStatModel'

error C2039: 'foreground_regions' : is not a member of 'CvGaussBGModel'
在网上搜到的解决方法都是这样写的:
在cvaux.h文件中,
搜索关键字foreground_regions,

CvMemStorage* storage; /*storage for 揻oreground_regions?/ \
CvSeq* foreground_regions /*foreground object contours*/

改为如下形式:

CvMemStorage* storage; /*storage for foreground_regions*/ \
CvSeq* foreground_regions /*foreground object contours*/
具体原因解释如下:首先foreground_regions 定义在这个宏里面:
#define CV_BG_STAT_MODEL_FIELDS()                                                   \
    int             type; /*type of BG model*/                                      \
    CvReleaseBGStatModel release;                                                   \
    CvUpdateBGStatModel update;                                                     \
    IplImage*       background;   /*8UC3 reference background image*/               \
    IplImage*       foreground;   /*8UC1 foreground image*/                         \
    IplImage**      layers;       /*8UC3 reference background image, can be null */ \
    int             layer_count;  /* can be zero */                                 \
    CvMemStorage*   storage;      /*storage for 揻oreground_regions?*/              \
    CvSeq*          foreground_regions /*foreground object contours*/
“\”在这里代表续行的意思。并且注意前面定义的变量后面都有“;”号,而foreground_regions没有,因为它是这个定义的最后一项,因为宏定义末尾是不加‘;’号的。
另外要注意的是,千万不要在修改最后两行时写成这个样子:   
 CvMemStorage*   storage;      /*storage for 揻oreground_regions?*/              \

    CvSeq*          foreground_regions /*foreground object contours*/
即不能放入空行,因为这样一来foreground_regions就不属于宏定义中的一份了。而'CvFGDStatModel''CvGaussBGModel'中均包含了改宏,所以错误会照旧的。偶刚开始就犯了这个错误,还以为是各位高手犯错误了呢。呵呵
posted @   姜大伟  阅读(316)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示