如何在使用Visual Studio 2017开发Linux应用程序时从Linux获取窗口 [英] How can I get the window from Linux while using Visual Studio 2017 to develop an application for Linux
问题描述
通常,我可以通过使用Putty& amp;来获取Linux上的窗口。通过SSH进行Xming。现在我正在尝试使用VS2017在Linux中完成OpenCV应用程序,在调试应用程序时如何从Linux系统获取窗口。
例如:
#include< cstdio>
#include< opencv2 / opencv.hpp>
using namespace std;
使用命名空间cv;
int main()
{
VideoCapture camera;
Mat框架;
camera.open(0);
if(!camera.isOpened())
cout<< "未能打开相机!" << ENDL;
else
cout<< "成功打开相机!" << ENDL;
camera.read(frame);
imshow(" test",frame);
camera.release();
waitKey();
destroyAllWindows();
printf(&#hello from camera!\ n");
返回0;
}
当我调试代码时,输出为
"无法初始化服务器:无法连接:拒绝连接
(测试:28058):Gtk- [1; 33mWARNING [0m * *:无法打开显示:"
(表示无法连接:拒绝连接)
所以我该怎么办?
你好colin1501,
欢迎来到MSDN论坛。
这个问题似乎是visual studio没有 连接Linux系统。请参考以下步骤:
1,检查项目是否已连接指定的Linux系统
右键单击项目>>选择属性,在右侧窗口中,请检查"远程构建机器"
2,如果它没有连接Linux系统,请在visual studio中添加新连接
工具> >选项..>>选择跨平台>>通过SSH添加远程Linux
请参阅
这里了解更多信息。
希望它可以帮到你。
最好的问候,
迪伦
Normally, I can get the window on Linux by using Putty & Xming through SSH. Now I'm trying to finish an OpenCV application in Linux by using VS2017, how can I get the window from the Linux system when I'm debugging the application.
for example:
#include <cstdio> #include <opencv2/opencv.hpp> using namespace std; using namespace cv; int main() { VideoCapture camera; Mat frame; camera.open(0); if (!camera.isOpened()) cout << "failed to open camera!" << endl; else cout << "successed to open camera!" << endl; camera.read(frame); imshow("test", frame); camera.release(); waitKey(); destroyAllWindows(); printf("hello from camera!\n"); return 0; }
when I debug the code, the output is
"Unable to init server: 无法连接:拒绝连接
(test:28058): Gtk-[1;33mWARNING[0m **: cannot open display: "
(which means can not get connection: refuse to connect )
so what should I do?
Hi colin1501,
Welcome to MSDN forum.
This issue seems that visual studio doesn't connect the Linux system. Please refer to the following steps:
1,Check whether the project has connected the specified Linux system
right-click the project>> select properties, in the right window, please check the "Remote Build Machine"
2,If it doesn't connect Linux system, please add a new connection in visual studio
Tools >> Options..>>select Cross platform >> add remote Linux through SSH
Please refer to here for more information.
Hope it can help you.
Best Regards,
Dylan
这篇关于如何在使用Visual Studio 2017开发Linux应用程序时从Linux获取窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!