All of a sudden, I'm getting "Expected unqualified-id" and "Type name declared as a reference to a reference" parsing issues from importing opencv2/opencv.hpp I tried relinking opencv3, upgraded from opencv 3 to 4 and restarted Xcode. How can this be resolved? Used prebuilt opencv from here: https://opencv.org/releases/ and Xcode 10.2
Expected unqualified-id:
CODE - Removed everything and left with this, but it still has parsing errors.
-------
.mm
------
#import <opencv2/opencv.hpp>
#import <opencv2/imgcodecs/ios.h>
#import <Foundation/Foundation.h>
#import "OpenCVWrapper3.h"
#include <vector>
using namespace std;
@implementation OpenCVWrapper3
+ (NSString *) openCVVersionString
{
return [NSString stringWithFormat:@"OpenCV Version %s", CV_VERSION];
}
@end
----
.h
----
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface OpenCVWrapper3 : NSObject
+ (NSString *) openCVVersionString;
@end
Ok so... I don't have a clue what caused the error. I opened another ios project that uses opencv and it gave the same errors. Then I created a new project and added #include iostream, ostream and got the same error. So its was not isolated to opencv. So I deleted and reinstalled Xcode and now it works!! Bizarre!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.