QT、VS常见bug及解决办法(七)——错误 1 error C3646: “cvAlloc”: 未知重写说明符

错误    1    error C3646: “cvAlloc”: 未知重写说明符    D:\Program File\opencv\build\include\opencv2\core\core_c.h    61    1    grey_level_transformation

解决办法:

    在MSDN的官方网站中,Complier Error C3646的定义为unknown override specifier,并且其解释为The compiler found a token in the position where it expected to find an override specifier, but the token was not recognized by the compiler.

1.循环引用

    在分离式编译中,我们往往习惯将不同的类或者函数分别写在不同的函数中,提高工作效率。但如果在使用时出现两个类分别在两个不同的文件中编写,并且相互引用,则会出现循环引用,引发此错误。

举例:tire.h/tire.cpp和auto.h/auto.cpp 在tire.h中include auto.h,并定义了一个auto的object,然后在auto.h中又include了tire.h

解决方案:在报错的那个.h文件的类定义前加上class声明调用的类(即class 类)。

2.语法错误

    此问题大多因为粗心而导致,比如在某个成员函数中把分号;写成了中文分号;,将会出现此类错误。

解决方案:修改分号

3.类的顺序错误

    如果一个类的成员中包含另一个类,则被包含的类的生命一定要在包含的类之前。

举例:

class Auto {
      Tire tire;
}
 
class Tire {
      int weight;  
}
 
// This will cause error C3656

解决方法:调整类的位置。

转自:http://blog.jobbole.com/109692/

    但是,以上3种方法对我程序中出现的问题没有借鉴意义。

你可能感兴趣的:(VS,bug)