NVCC - host compiler targets unsupported OS [duplicate] - build

This question already has answers here:
Using CUDA with Visual Studio 2017
(9 answers)
Closed 5 years ago.
I've been trying to get CUDA working on my PC. I tried clean (re-)installing the latest drivers and CUDA as well as latest Visual Studio 2017 RC Build Tools. My operating system is Windows 10 (64-bit) build 14393.693, GPU is GTX 1060 6GB (Driver version 378.49), CUDA version 8.0.44.
I took a simple demo from one of the NVIDIA blogs and when I try to compile with "nvcc", I get "nvcc fatal: Host compiler targets unsupported OS".
I setup my envrionment by opening a command prompt in the folder with the .cu file, then running "vcvars64" to add the 64-bit cl.exe to my environment variables. I also tried this with "vcvars32" and I get same result.
I can confirm that cl.exe will compile a "HelloWorld" C file.

Try using a supported host compiler.
Edit: The question has since come up again and gotten a better answer here: Using CUDA with Visual Studio 2017

Related

Release C++ code using Visual Studio 2017 [duplicate]

This question already has answers here:
Visual Studio 2017 C++ Exe for any pc (linking vcruntime140.dll)
(2 answers)
Closed 2 years ago.
I have written a C++ project using Visual Studio 2017 in Windows 10. I am trying to run the code in other computers as well.
So, I tried copying the Release folder to another Windows 10 computer. But, when I try to execute the .exe file, it is showing errors: missing dll’s: vcruntime140.dll and ucrtbased.dll.
Please help me in the release process to be followed.
The reason is because your application is dynamically loading the VC runtime which gets installed with the Redistributable package. Typically people can install the Redistributable packages without the full SDK but the easier solution is to just compile your application to statically load the C runtime libraries.
Go to project settings, then C/C++->Code generataion and change your runtime library from /MD to /MT. /MD is dynamic and /MT is static.
Also you can just install the package on your other machine from here https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

Visual c++ problem in compiling native windows 10 application [duplicate]

This question already has answers here:
MSVCP140D.dll missing, is there a way around? [closed]
(2 answers)
Closed 3 years ago.
I'm coding a native C++ application in Vs 2019 that sould be able to run on a freshly configured windows 10 machine.
The problem is that when i run my .exe app on this machine i get missing dlls error such as MSVCP140D.DLL, VCRUNTIME140D.dll etc.
I tried to install the vcredist from MSDN on the guest machine and i also tried changing the "runtime library" from the "code generation" module in the project config.
I also followed some other tutorials that i've read on this platform but i can't find nothing that really works.
I even tried to place the missing dlls in the same directory of the .exe file to register them manually, actually it does not work, but this app i'm developing should be redistributable so the user should have just to execute it.
If i try to compile my program with another compiler such as MinGw it works but i wanted to use the vc++ default compiler if possible.
Is there a way to solve this issue?
Thanks!
Maybe you used MSVCP140.DLL, wihtout the D. the D stands for DEBUG and I don't know if the Debug version version comes with the visual studio redistributable. If you compile in visual studio try to build the Release version, this should work with the DLL´s from the redistributable

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

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.

how/where to grab compiler of msvs 2008 (32bit) compiler toolchain without installing msvs2008 [duplicate]

This question already has answers here:
download and install visual studio 2008 [closed]
(6 answers)
Closed 5 years ago.
I'm relatively new-comer to developing in windows ("7") and the environment that has been set up for me is using as IDE MS Visual Studio 2015. For a new project I'll be involved in I will work with a team who have been developing in Visual Studio 2008 a 32bit application.
As I try to create the development environment using cmake and selecting as target compiler "Visual Studio 9 2008" , cmake whines that
CMake Error at CMakeLists.txt:10 (project):
No CMAKE_CXX_COMPILER could be found.
CMake Error at CMakeLists.txt:10 (project):
No CMAKE_C_COMPILER could be found.
So I would need to obtain the respective toolchain. I have no idea how to do that in windows though and google (at least with the search terms I have used) has not been very helpful.
Note: The IDE of the team is indeed old but it is not an option to ask all of them to migrate now to a newer version.
Note2: As I understand, I cannot obtain a license for "Visual Studio 2008" anymore, but even if this is not the case, I would prefer to continue using visual studio 2015 even while developing this project. Is it possible to just obtain the compiler toolchain of 2008 and integrate it somehow so that
1) cmake can find it
2) visual studio 2015 can use it
Easiest way to go would be to install Visual studio 2008 Express if you can find the installer. It is free, and you can use its compiler without using the IDE.
In cmake you can separately select target IDE version (generator) and target compilers (toolchain).
AFAIK there was no separate download just for the compilers but there were some bundles which include it and you can try your luck with them if you can't/don't want to install full VS2008 installation (cmake might have some difficulties finding this versions though).
"Microsoft Visual C++ Compiler for Python 2.7" package should contain just the compiler/libraries part of the VS 2008
"Windows SDK 6.1" and "Windows SDK 7.0" (but not "Windows SDK 7.1") include a version of the compiler which should be compatible with VS2008

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.