SDL driver fails when starting debug session on remote linux - c++

On Win10, I have a visual studio c++ project for linux that uses the SDL2 driver. The target machine is a VirtualBox - Ubuntu 18.04.
I configured Visual studio to compile remotely on the target system, which works fine.
Running the output file from console on the remote machine shows that SDL uses the XServer:
SDL_GetCurrentVideoDriver: x11
When I start debugging from visual studio (starts GNU debugger gdb on remote side):
SDL_Init error: No available video device
SDL_GetCurrentVideoDriver: null
starting gdb from remote anyway works as expected:
gdb ./myProgram
(gdb) run
But this doesn't let me debug in visual studio, which i'm looking forward to. Any idea ?

In Project Settings:
Configuration Properties -> Debugging -> Pre-Launch Command -> export DISPLAY=:0

Related

Building a program usually build in Linux using the "make" in a VSC Window using WSL

I have a Linux C++ program that I build with GNU Make using the "make" command. How can I convert this to a task.json and a launch.json file for debugging on Visual Studio Code with a WSL
Basically the title. I have a directory that I use in Linux, and simply use the "make" command to build my program with a Makefile. But I need to move to Visual studio, I have managed to get it working in the sense that I can now edit code in VS and then head back to my terminal to "make" again and test but debugging in command line with gdb is not fun so I would like to be able to do it in VS but am having trouble configuring the .json's to get it to build and run and debug correctly.
The build only actually generates .exe's which then would need to be run with the debug setting on.
Any help greatly appreciated!
EDIT: In fact I basically just want Visual Studio Code to be able to debug my program. To build it I actually need to run 2 .sh scripts and then the make file. Is there a way I can make this happen in VSC using the build option and then debug it?
Not 100% sure what you are asking but I am assuming you run Visual Studio Code on Windows and need to compile and debug a program with the Windows Subsystem for Linux (WSL).
You can do that with the remote development extension. The Visual Studio Code C/C++ extension also supports remote development.
This works for WSL but also for compiling and debugging on a Linux server (using SSH).

Visual Studio fail to attach to C++ process on Centos?

I am trying to debug a c++ process on Centos7 using Visual Studio 2017. But I am not using a Linux Project built by VS, just want to attach to remote linux process using ssh. I have done the same things on a ubuntu16.04 machine, all thing works fine, but not in this time on Centos7.when I try to attach,VS allertcan not connect to remote host,unsupport operation,unknow error 0x8004005
Does anyone know why?

Remote Debugging with Microsoft Embedded Visual C++

I need to attach remote debugger to the process running on Telmet320 device. The executable for that device is build using Microsoft Embedded Visual C++ 4.0. I have a connected device, source of application and Embedded Visual Studio installed on my desktop. But I do not see a possiblity for the remote debuggin in Visual Studio itself. Also I did not find remote tool for Embeded Visual studio (Not sure if they are exist at all).
Any help will be very valuable.
Found a solution. In Embedded Visula C++ goto to Build -> Start Debug -> Attach to WCE Process ...

Error when Visual Studio Remote Debugging with GDB

I have a sample c++ application which builds and runs fine in a Red Hat installation.
I wanted to have the source code of this application in my windows machine so I can create a Visual Studio project and use Visual Studio 2017's new features which makes it possible to build and debug programs on a Linux server.
I successfully managed the following
Create a 'make file' project using Visual Studio CE 2017
Connect to the remote server and build by invoking make command at
the server
My remote debugger settings are as follows
Remote Build Settings are as follows
General Settings are as follows
However, when I try to debug the program via Visual Studio (using gdb in the server) following error occurs
Since this doesn't reveal much, I enabled verbose mode (in GDB) and following is the verbose output. Apparently, GDB crashes after loading symbols for one of the source files.
Furthermore, I can manually GDB the binary in the Linux Server without any problems

Cross compile on windows linux subsystem and deploy to target using Visual Studio 2017

I have a beaglebone black for which I want to cross compile on the windows linux subsystem but deploy it afterwards onto the target (Beaglebone). I have installed the cross compiler on the linux subsystem but I'm not quite sure how to hook everything up on the visual studio end.
Basically I want to:
Write code in Visual Studio 2017
Build on the Windows Linux Subsystem
Deploy on the ARM Target over SSH (Beaglebone black)
The first two steps are straightforward and there are several guides for you to read, one of which has been referenced above.
Using WSL, you're only going to be able to target x86 with a simple project type (MSBuild). But you can at least get it compiled and maybe do some debugging.
For the Beaglebone you'll need a makefile project. Visual Studio sees the makefile as a black box that generates a build target. Inside that box you will write the commands to cross-compile to an ARM executable and copy it to the appropriate destination. Build errors will be reported back to Visual Studio but you won't be able to debug the cross-compiled application on the Beaglebone.
You'll find some information here to get you started with makefile projects.