我不断收到此警告
警告1警告C4566:由通用字符名称'\ u202A'表示的字符不能在当前代码页(1252)C:\ Users \ ankitdeora2856 \ Downloads \ opencvFiles \ main.cpp 1088中表示
[在Visual Studio 2012中用C ++运行我的opencv代码时。我的代码正在构建,没有任何错误,但是此警告正在产生问题,未获得预期的输出。我正在尝试使用addweighted()函数添加两个图像,但由于此警告而无法获得输出。
#include <cv.h>
#include <highgui.h>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
double alpha = 0.5; double beta; double input;
Mat src1, src2, dst;
/// Ask the user enter alpha
std::cout<<" Simple Linear Blender "<<std::endl;
std::cout<<"-----------------------"<<std::endl;
std::cout<<"* Enter alpha [0-1]: ";
std::cin>>input;
/// We use the alpha provided by the user if it is between 0 and 1
if( input >= 0.0 && input <= 1.0 )
{ alpha = input; }
/// Read image ( same size, same type )
src1 = imread("pic1.jpg");
src2 = imread("pic2.jpg");
if( !src1.data ) { printf("Error loading src1 \n"); return -1; }
if( !src2.data ) { printf("Error loading src2 \n"); return -1; }
/// Create Windows
namedWindow("Linear Blend", 1);
beta = ( 1.0 - alpha );
addWeighted( src1, alpha, src2, beta, 0.0, dst);
imshow( "Linear Blend", dst );
waitKey(0);
return 0;
}
一个UTF-8字符('\ u202A')在代码中的某个位置,但是使用当前的编码无法看到。
我也有这个问题,为了解决这个问题,我将代码粘贴到Notepad ++中,然后在“编码”下的顶部将其更改为ANSI,出现了隐藏字符,我能够删除它们并将结果粘贴回Visual Studio中。 。