我构建了一个在后台运行的程序,并检查两个图像是否相似。当我以标准跑步方式跑步时,它会做得很好。但当我想在隐藏窗口(在后台)中运行它时,我会收到以下错误:
-
未解析的外部符号主控制台Application2
-
未解析的外部控制台Application2
这是我的代码:
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <atlimage.h>
using namespace cv;
using namespace std;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
int count_inequality = 0;
Mat image, image2;
image = imread("hh.jpg", IMREAD_COLOR); // Read thVec3b intensity = img.at<Vec3b>(y, x);
image2 = imread("gg.jpg", IMREAD_COLOR); // Read thVec3b intensity = img.at<Vec3b>(y, x);
float blue;
float green;
float red;
float blue2;
float green2;
float red2;
for (int i = 1; i <= 1000; i+=10) {
for (int h = 1; h <= 900; h += 10) {
Vec3b intensity = image.at<Vec3b>(i, h);
blue = intensity.val[0];
green = intensity.val[1];
red = intensity.val[2];
Vec3b intensity2 = image2.at<Vec3b>(i, h);
blue2 = intensity2.val[0];
green2 = intensity2.val[1];
red2 = intensity2.val[2];
if (blue == blue2 && green == green2 && red == red2) {}
else {
count_inequality++;
if (count_inequality == 3){
//Code what happens if will be 3 inequality.
}
}
}
}
return 0;
}
有人能帮我吗
项目的名称ConsoleApplication2
,所以我假设您使用了"控制台应用程序"的Visual Studio项目模板。
该模板设置SUBSYSTEM:CONSOLE
选项,这意味着程序希望从具有签名int main(int argc, char* argv[])
的函数开始
因此,您需要将该选项更改为/SUBSYSTEM:WINDOWS
,或者您需要更改WinMain
函数的签名。