Is creating a Linux Shared Library from Visual Studio 2017 Possible? [duplicate] - c++

This question already has answers here:
C++ cross-compiler from Windows to Linux [closed]
(5 answers)
Closed 5 years ago.
I was wondering if it's possible to create a shared library for Linux from within Visual Studio 2017?
Or would I have to develop on Linux and compile for Windows instead?
Thanks!

Visual studio can't build linux library with its built in toolchain, so you need an extern build system.
You have two option for the external toolchain:
cross compiler
docker
cross compiler is more suited for clean/freestanding environment. If your code rely on certain 3rd party libraries (and your target linux is compatible) it might be more convenient to use docker.

Visual Studio 2017 can run external tools, so if you have a compiler that will generate Linux code while running on Windows you can do it.
If you have a Windows computer and a Linux computer in the same network, you can also set up Visual Studio on the Windows computer to run tools on the Linux computer.

Related

how to setup Visual Studio Code for c++ for windows? [duplicate]

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.

C++ Setup For VS Code [duplicate]

This question already has answers here:
How do I set up Visual Studio Code to compile C++ code?
(14 answers)
Closed 10 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.
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.

How to run a C++ application built in Visual Studio 2015 on another machine [duplicate]

This question already has answers here:
using static libraries instead of dynamic libraries in opencv
(5 answers)
Closed 6 years ago.
I have been developing some programs in C++ using Open CV on Visual Studio 2015 and am trying to run the executable produced from building Visual Studio on another machine, but on the new machine it informs me that multiple .dll files are missing. Is there such a way to compile it in Visual Studio that it will not require these .dll files, or is there a way to have all of the .dll files on the new machine?
I am running in x86 Release and have changed the C / C++ code generation to just Multi Threaded.
The Open CV I have installed is 3.0, does this cause issues with using Visual Studio 2015?
Cheers
You need to install the Visual Studio redistributables on the machine where the application is going to run : http://www.microsoft.com/en-us/download/details.aspx?id=48145
Either have your installer install the redist. Ask the user to do it. Or bundle the libraries manually with your executable.

How can I configure visual c++ 2008 for 64 bit? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to compile a 64-bit application using Visual C++ 2010 Express?
How can I compile 64 bit with visual c++ 2008
I am trying to compile an application that contains CUDA code. I have visual c++ 2008 express version (the free version) on my computer. To be able to use the cuda compiler I followed the steps from here, here and here. The cuda files (with *.cu extension) now compile fine, but the other normal C++ files are using 32 bit because at the drop box on the top (configuration manager) of IDE, it says Win32. There is no option to make it Win64. What should I do to tell configuration manager to use 64 bit. Note that I have 64 bit compilation tools now that I installed the Windows SDK.
Visual Studio Express 2008 doesn't ship with the x64 compiler, that's reserved for the pro versions.
The command-line version is included in the Windows SDK though, which is available for free. You can find some information about adding the 64bit compiler to Visual Studio Express on the internet, but it's a big hack. Just a quick search on google revealed for example this blog-entry: https://jenshuebel.wordpress.com/2009/02/12/visual-c-2008-express-edition-and-64-bit-targets/
http://msdn.microsoft.com/en-us/library/9yb4317s%28v=vs.90%29.aspx
"64-bit tools are not available on Visual C++ Express by default. To enable 64-bit tools on Visual C++ Express, install the Windows Software Development Kit (SDK) in addition to Visual C++ Express. Otherwise, an error occurs when you attempt to configure a project to target a 64-bit platform using Visual C++ Express."
Right click the solution -> Active solution platform -> New... -> x64 (under "Type or select the new platform:)

MS C++ (CL) compiled executable does not work on Windows 2000 [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Issue using Visual Studio 2010 compiled C++ DLL in Windows 2000
Similar to these questions:
Can I use Visual Studio 2010's C++ compiler with Visual Studio 2008's C++ Runtime Library?
Can VS2010 create native executable file working under Windows 2000?
I have C++ code that I'm compiling from the command line (using CL.EXE) using VS2010 (CL version 16.00.30319.0) on a WinXP machine, but I want the resulting native (x86) executable program to run on Win2000, WinXP, etc.
Older versions of CL (VC98, version 12.00.8186) do the job just fine, but the VS2010 version produces an executable that, when run on Win2000, results in a pop-up error:
foo.exe is not a valid Win32 application
The solution must be in the form of CL compiler or linker options, not VisualStudio settings or properties. I don't need any of the newer C++ language features, since the code is a few years old and written to be portable to other OSs, and I want only native code (x86, not .NET or CLI) executables.
(See http://david.tribble.com/src/crlf.cpp and http://david.tribble.com/src/detab.cpp for examples.)
I suppose I could keep using the older compiler (VS 9.0) on my new development environment (WinXP, and eventually Windows 7), but that seems like a less than ideal solution. Surely MS still provides a way to create native executables that are backward-compatible to older but still-extant Windows OSs?
Your error "foo.exe is not a valid Win32 application" can be fixed by using editbin to set the "Minimum OS version" field in the PE header to 0x0500 (Windows 2000).
EDITBIN /VERSION:5,0 foo.exe
You'll need an old version of editbin for this, or a third-party tool, since the new one "sanity checks" the version you give it.
After this, the application will load, but it may start complaining about missing functions in kernel32.dll.
Billy's question you linked to will take you farther down the rabbit hole than any sane programmer wants to go.