简体   繁体   English

uint8_t *预计a;

[英]uint8_t* expected a ;

VS10 is underlining uint8_t, saying that it expected a semi-colon. VS10正在强调uint8_t,称它预计会出现分号。

Here's my code snippet:- 这是我的代码片段: -

uint8_t* pixelPtr = (uint8_t*)image.data; //this line shows the error (expected a ;)

Yet, when I use it lower down my code, no errors are attached to it:- 然而,当我使用它降低我的代码时,没有错误附加到它: -

typedef Scalar_<uint8_t> bgrPixel; //this line is error free

Did you forget a ; 你忘了一个; on a previous class or struct declaration? 在以前的classstruct声明? If so, then it's interpreting uint8_t as a variable name that is an instance of that struct or class . 如果是这样,那么它将uint8_t解释为变量名称,该变量名称是该structclass的实例。

For example, if you did this: 例如,如果你这样做:

class clown
{
    // yadda
    // yadda
    ... 
} // notice no semicolon here

uint8_t *pixelPtr = (uint8_t*)image.data;

The compiler effectively sees: 编译器有效地看到:

class clown
{
    // yadda
    // yadda
    ... 
} uint8_t *pixelPtr = (uint8_t*)image.data;

and naturally wants a semicolon after uint8_t , so it looks more like this: 并且在uint8_t之后自然想要一个分号,所以它看起来更像是这样的:

class clown
{
    // yadda
    // yadda
    ... 
} uint8_t; // which would declare an instance of class clown named uint8_t

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM