Visual Studio String Visualizer with WSL2 - visual-studio-debugging

Visual Studio Community 2022 Version 17.1.0 and Ubuntu 20.04 in WSL2
My project is a CMake project imported with Open->Folder into VS.
With other Windows projects, when I debug in VS I can use the String Visualizer to view it as Text, XML, HTML or JSON, but when I choose the WSL2 as the build target and debug, I don't see the option to use String Visualizer at all.
String Visualizer options are showing when I debug Windows program:
No String Visualizer option when I debug in WSL2:
Any way to enable String Visualizer for WSL2?

Related

Visual Studio 2022 make file project with debugging

I'm trying to run the debugger with the “make file project” in Visual Studio 2022 but is showing me an error. The same project builds without an option “make file” work fine.

Compile C code in Visual Studio in Windows for Linux

I'm using Visual Studio in Windows to develop basic C applications. I want to compile my code for Linux, without the need to have Linux installed on my machine. Is that possible ? And how ?
You'll need to have Linux installed somewhere. If you can remote to a linux box, vm, or WSL console, from your Visual Studio machine, you can use VS 2019 to build and debug most applications in any of those environments, via the Cross Platform Connection Manager.
The following blog and document links are a good place to start.
Targeting the Windows Subsystem for Linux from Visual Studio
C++ with Visual Studio 2019 and Windows Subsystem for Linux (WSL)
EA and Visual Studio’s Linux Support
Usability Improvements for CMake in Visual Studio 2019 version 16.4: Launch Target Selection and Overview Pages
Similarly, Visual Studio Code has some support for this as well:
Using C++ and WSL in VS Code
Sincerely,
yes, it is possible.
Have a look at this stackoverflow question.
Install WLS on your Windows machine
Use the standard gcc instruction (or, better, Makefiles and/or CMake)
Example:
Let's say you have your program:
//code within filename.c
#include <stdio.h>
int main(){
printf("Hello Youssef\n");
return 0;
}
Then, within the folder, run:
$ gcc filename.c
and then run it:
$ ./a.out
Hello Youssef
You can install a VM (virtual machine) on your windows computer, then install linux on the virtual machine.
Note: both the VM and linux are free downloads

How do i perform make file in windows

i want to use this library https://github.com/json-c/json-c with my C program in codeblocks(windows) but i dont know how to make makefile/cmake on windows.
I dont know how to do it in this particular example. There is only something like "Config.cmake.in".
Any ideas?
You didn't state what kind of build environment you are using on Windows.
So find below a short description how i built the 32-bit version of json library on Windows 10 using cmake 3.14.3 and Visual Studio 2015. CMake supports several generators for Visual Studio as well as MinGW (see CMake documentation).
Open command window (cmd.exe) change to root directory of json-c library source.
Setup build configuration for 32 bit target in directory "build" using command line "cmake -G "Visual Studio 14 2015" -A Win32 -B build"
Open command window for Visual Studio 2015 x86 environment (link at start menu) and change to build directory created during previous step.
Run "msbuild json-c.sln" to build Debug version of json-c dynamic library
Run "msbuild json-c.sln /p:Configuration=Release" to build Release version of json-c dynamic library
After that you should be able to add the built library to your project.

Upgrade Visual studio solution VS2010->VS2017:

I'm trying to build the Postgresql odbc driver in VS2017.
The existing project and solution is a VS2010 project.
When I re-targeted the solution and project, I have problems:
x64 (Release, Debug) builds ok
x86 (Release, Debug) does not build:
error MSB8013: This project doesn't contain the Configuration and Platform combination of Release|Win32.
But I have checked: not any Win32 in project and solution files, only x86 and x64.
In the VS 2017 solution explorer: when I select the x86 I see the project name as "pgodbc (Visual Studio 2010)", when I select x64 I see "pgodbc".
What do I need to check/change?

Unable to use VS2015 Project installers with 64-bit project

I was wondering if anyone was able to successfully create Installer Project for a 64-bit WinForms application on VS2015.
When I try to compile the installer project for simple 64-bit WinForms project that only displays a message box, I get the following:
ERROR: File 'WindowsFormsApplication2.exe' of project output 'Primary
output from WindowsFormsApplication2 (Debug x64)' targeting 'AMD64' is
not compatible with the project's target platform 'x86'
And when opening the installer project properties I don't find any option for changing the installer project to x64.
Edit:
I already tried the project properties:
However while the link provided in Cody Gray's comment is for VS2010, it suggests that "Creating 64-bit MSI packages is not available in Visual Studio Express Edition.
"
And I'm using VS2015 community which is free. Could that be the problem?

Resources