I have a C++ project that I cross-compile using a makefile (written by me, not automatically generated).
I have recently moved to WSL2 and have been missing the good ol' days when I used Eclipse since (Visual Studio Code is not even close to what Eclipse can do).
I decided to give Visual Studio a go but I all I could find is this article about VS + WSL2 + cmake.
https://learn.microsoft.com/en-us/cpp/build/walkthrough-build-debug-wsl2?view=msvc-170
Is it possible to create a C++ makefile project under WSL2 with Visual Studio?
Related
This question already has answers here:
How do I set up Visual Studio Code to compile C++ code?
(14 answers)
Closed 3 months ago.
So my teacher is wants the class to install C++, and I don't know how to do it. Please help me set it up in Visual Studio Code because it's the IDE I'm most familiar with. Please explain it in the simplest way possible.
I tried installing vscode and c++ extension but library files are missing
If you are going to edit and execute on Windows, you have to install either Visual Studio regardless or g++ under MinGW. These instructions are very detailed:
https://code.visualstudio.com/docs/languages/cpp
To configure VSCode with MS compiler:
https://code.visualstudio.com/docs/cpp/config-msvc
To configure VSCode with gcc on Windows:
https://code.visualstudio.com/docs/cpp/config-mingw
Another alternative that I recommend is to use Windows WSL which is like a Linux inside Windows.
https://code.visualstudio.com/docs/cpp/config-wsl
Then install the C++ extensions for VSCode.
Then I recommend you install cmake for Windows. Although the tutorials will teach you how to build a single file, you will need more for large projects.
https://cmake.org/install/
Create a CMakeLists.txt and then use the cmake-gui to create the Visual Studio project files. All this is outside Visual Studio Code.
To build from inside VSCode I found it particularly cumbersome. I'd rather Alt-Tab and build the project manually by either calling 'make' or building inside Visual Studio. But it's your preference.
But if you are editing on Windows and running on Windows, I'd strongly suggest to run inside Visual Studio itself. Not only you will have way more support for your questions but also the Visual Studio debugger is arguably the best in the market.
I am using Visual Studio for Mac 2022, and I am trying to create a C++ console application, does anyone know how to get those templates shows up when I choosing language?
Visual Studio for Mac is an IDE solely for .NET development.
If one looks at the Visual Studio website, it provides a comparison of the Mac and PC versions of Visual Studio. C++ development is not available for Visual Studio 2022 for Mac.
However, there exist many IDEs that support C++ development on Mac. Apple's very own Xcode allows the creation of C++ projects, as well as Visual Studio Code, a highly extensible code editor. CodeBlocks and CLion also exist as C++ IDEs for macOS.
I have some C++ projects/programs which are created in Linux and containing make file as well.
I am using window 7 and visual studio 2015. Today I just installed Ubuntu Linux in virtual box BUT do not really know how to start with and run these programs.
What is the easiest way to run theses projects?
I am very new in C++ programming so a detailed answer is needed.
If you want to work in Visual Studio on Windows a good choice would be Visual C++ for Linux Development (VCLinux) : see tutorial here
The tutorial creates a Visual Studio (VS) project that builds with MSBuild (VS's internal build system). However you can also create a makefile project that will build with make. MSBuild is easier to work with if you know VS or have an existing VS project, make is more flexible and might be the best choice given an existing makefile. You should try some simple examples and decide which works for you.
For a CS class I'm taking, the C++ assignments need to be submitted as Visual Studio 2012 projects. I'd really rather not use Visual Studio, so I'm thinking about creating cmake projects instead, then generating Visual Studio project files using cmake. I know this is possible using cmake -G "Visual Studio 11", but this only seems to work on Windows. When I run cmake on my computer, I get a list of generators, and the Visual Studio generators aren't listed. I know that the cmake website says that generators are platform specific, but is there some way to get these generators working on OS X?
Edit: For anyone coming across this question later, you should look into premake instead of messing with cmake. If you get premake 5, which is currently the development version, you can use it to generate Visual Studio 2012 files from Mac or Linux without needing to use Windows at all (on Windows you can generate Xcode projects without having to use OS X as well).
CMake needs to call Visual Studio compiler to check compiler version, so I doub't it could find it on OS X, that why it's platform specific.
I have installed Code::Blocks on my (Windows) machine. It is working fine.
However there are some open source libraries that i would like to use. For this i will have to build the library on my machine. However the source code is available in the form of a MS Visual Studio solution file.
I've tried to use the 'Import Project' feature of Code::Blocks but got errors with that. I am now thinking of installing MS Visual Studio express edition to see if can build the library using it. I do want to keep my install of Code::Blocks.
I wanted to ask if there are any problems having these two IDEs (Code::Blocks & MS Visual Studio Express Edition) on the same machine? I know they use different default compilers.