Error: expected qualifier-list-qualifier before 'cv'

I use the OpenCV environment for image processing, I define the edge in the photo for a normal iOS project, now I convert this code to a cocos2d project, I imported all the required headers, but when compiling I get this error: expected specifier-classifier-list to 'cv '. here is my code

     #import "cocos2d.h"
     #import "CameraController.h"
     #import "Globals.h"

     @interface BotoxEffectController : CCLayer 
     { cv::VideoCapture *_videoCapture; cv::Mat _lastFrame;}//this is line where i am
       getting error

     @property (nonatomic, retain) CCSprite *sprite2D;
     +(CCScene *) scene;
     @end

     here is code in .pch file.

     #import <Availability.h>

     #ifndef __IPHONE_3_0
     #warning "This project uses features only available in iPhone SDK 3.0 and later."
     #endif

     #ifdef __cplusplus
     #import <OpenCV/opencv2/opencv.hpp>
     #endif

     #ifdef __OBJC__
     #import <UIKit/UIKit.h>
     #import <Foundation/Foundation.h>
     #endif

Please refer to the BotoxEffectController interface screen for an error and the implementation file has a .mm extension. BotoxEffectController

here is the .pch file where I import opencv.hpp

.pch

+5
source share
1 answer

I think I know what's going on here. Try adding the OpenCV header to the BotoxEffectController header file:

#import <OpenCV/opencv2/opencv.hpp>

, prefix.pch. - #if __cplusplus. , , , :

#ifdef __cplusplus
#warning "ok so it DID import the OpenCV header"
#import <OpenCV/opencv2/opencv.hpp>
#endif

, , opencv prefix.pch . , , , . , : BotoxEffectController.h "Default-C Header", ++.

0

All Articles