Visual Studio 2017 with CUDA cannot open include file 'cuda.h' - c++

I am working on the Nvidia SDK with Visual Studio and I have been running into the error of this whenever I am trying to compile the sample from Nvidia:
Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: 'cuda.h': No such file or
directory AppDecPerf
c:\users\administrator\desktop\video_codec_sdk_8.1.24\samples\appdecode\appdecperf\appdecperf.cpp 12
I do have CUDA installed on my computer and it looks like I have to link it with the IDE somehow but I just cannot find 'cuda.h' file anywhere.
Any help is appreciated. Thanks!

Install cuda library( static or dynamic) for Windows in vc++ 2017 using vcpkg.exe. Use .\vcpkg integrate install to automatically link the project to your solution.
Use .\vcpkg install cuda:x64-windows-static to install.

Right click your project, choose Build Dependencies then Build Customizations. From here you can choose the version of the CUDA Toolkit that you'd like to work with (amongst other things it will add the $(CudaToolkitDir) variable, and a new CUDA C/C++ tab to the project properties). The samples from NVIDIA should already be configured this way, but I've noticed that they can break when upgrading the SDK.
Further details are available here:
https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#build-customizations-for-existing-projects

Related

Installing OR-Tools to Visual Studio 2022

I am trying to write a code using Google's OR-Tools on Microsoft Visual Studio 2022.
I followed the following steps:
Download OR-Tools from Binary on Windows on their website.
Extracted the .zip file in D:\CodeField
Wrote the complete TSP programs of their website on VS.
In Visual Studio, went to Project > Properties > C/C++ > Additional Include Directories
Added "D:\CodeField\or-tools_x64_VisualStudio2022_cpp_v9.5.2237\include"
Clicked Apply then OK then compiled my code.
I am getting a bunch of linking errors "1>ortools.lib(scip_callback.obj) : error LNK2001: unresolved external symbol SCIPconshdlrGetData".
what should I do?
Try adding the lib folder in linker settings and link ortools_full.lib. If there are other errors try changing the runtime library to /MD. Make sure you use C++17.
Visual Studio
To build and run OR-Tools on Windows, you must have Visual Studio 2019 or later installed on your computer with the C++ toolset for Visual Studio.
You can find more details here.
To build OR-Tools programs from the command line you must use a x64 Native Tools Command Prompt (not the Developer Command Prompt).
You can find more details here.
Git
Git, which can be downloaded from https://git-scm.com/.
CMake
CMake (>= 3.18), which can be downloaded from https://www.cmake.org/download. When installing CMake, select the option for a command-line accessible cmake.
.NET Core 3.1 SDK
You must install the package .NET Core 3.1 SDK version 3.1.100 or higher from the following location: sdk-3.1.425-windows-x64-installer
.Net 6.0 SDK
You must install the package .NET 6.0 SDK from the following location: sdk-6.0.403-windows-x64-installer
Download the source code
There are two distinct branches of the OR-Tools source code on GitHub: stable and main.
The stable branch has been thoroughly tested and should work flawlessly on all supported platforms.
The main branch is where the latest updates and improvements have been applied; it's more current, but less stable.

visual studio unable to find assert.h

I'm a first year at uni and I just got my new laptop. I downloaded Visual Studio 2017 and pulled my solution repo. However, I'm having some issues because it appears that a lot of the files I had on my previous computer were not downloaded in the installation of VS. My university wifi is slow and I don't want to re-download if I don't have to. I followed the previous steps I took to download VS 2017 on my old computer. Yet, I'm getting errors like:
cannot open source file "assert.h"
cannot open source file "errno.h"
cannot open source file "float.h"
cannot open source file "corecrt.h"
cannot open source file "stddef.h"
cannot open source file "stdio.h"
(among 20+ others)
If I right-click and choose the "Open document" on the line with the error, I get the message:
File '_______.h' not found in current source file's directory or in build system path
However, if I go to my include paths, I can find files like:
cassert.h
cerrno.h
ostream.h
but none of the ones that I'm told are missing.
Mainly, I'm wondering if there is a directory with this files I just need to add to the include directory or whether I just need to admit defeat and reinstall.
Thanks for the help, I welcome editing as I'm sure I've messed things up. I'm new to this.
Cheers,
Caleb
Using VS2017 I was able to resolve this same issue by:
Right click on solution
Selecting 'Retarget Solution'
Selecting an SDK from the Windows SDK Version dropdown
Clicking OK button
Your Visual Studio 2017 installation is probably missing the C packages (they are not automatically included with the Desktop development with C++ workload).
To install it, start the Visual Studio Installer, go to Individual components, and check Windows Universal C Runtime:
I think this component is also automatically marked for installation when adding the Linux development with C++ workload.
I solved the problem by uninstalling my original installation of Visual Studio (2019 version), then reinstalling and including the workload Desktop Development with C++.
In contrast to the above solutions, I did not need (and it did not help) to add the Windows Universal C Runtime.

Cannot open include file: 'ctype.h': No such file or directory

I installed c++ package on VS 2015 , if I tried to build the project ,the following problem appears :
C1083 Cannot open include file: 'ctype.h': No such file or directory Win32Project5 c:\program files (x86)\windows kits\8.1\include\um\winnt.h 31
Any possible solution ....
Repair / Reinstall visual studio.
Make sure that the Windows SDK option (Probably 8.1 in your case) is ticked,
As you can see in this picture:
To add the missing component, go to Control Panel -> Uninstall a Program, and select to Change the installation of Visual Studio.
Then, here is the option you need to check:
Then press "Modify".
Also don't forget to update the project's Properties to be using Windows SDK version 10.0.17134.0.
Right click on your solution or project in the solution explorer
& Retarget your solution or project to the installed SDK version
Here is mine VS 2017 build tools configuration to make Python 3.7 and up to compile on my local machine and fix. Please notice that MS changed VS Studio Build Tools interface
In order to make code to compile you also MUST to install ODBC driver
You can download VS 2017 Build tools from:
https://visualstudio.microsoft.com/downloads/

C++ OpenGL Project Setup using GLEW, assimp, SDL2 and CMake with CodeBlocks

I've done a whole tutorial about making a 3D Rendering Engine in OpenGL with Java and lwjgl and the guy who made the tutorial also wrote the engine in C++
To increase my knowledge about programming I wanted to take a look at the C++ version too. Also I believe (and I might be totally wrong) that I'm actually able to do a lot more with C++ than with java. The main problem I have is that I cannot get the engine running despite the included instructions and I would really appreciate if someone can help me out.
this is the engine i want to setup: https://github.com/BennyQBD/3DEngineCpp
I want to use CodeBlocks for this project since it was recommended and unlike Visual Studio it is free.. I also already downloaded glew, assimp and sdl and I installed CMake which are needed for this to run. Now I have to put that together according to this instruction here:
###Windows/MinGW###
- Make sure CMake is both installed and added to the system PATH.
- Open a Terminal and run:
```Shell
# install dependencies
# Install GLEW in %PROGRAMFILES%/GLEW or SET %GLEW_ROOT_DIR% to where GLEW is on your machine (Example: D:\PATH_TO_GLEW)
# Install SDL2 in %PROGRAMFILES%/SDL2 or SET %SDL2_ROOT_DIR% to where SDL2 is on your machine (Example: D:\PATH_TO_SDL2)
# Install ASSIMP in %PROGRAMFILES%/ASSIMP or SET %ASSIMP_ROOT_DIR% to where ASSIMP is on your machine (Example: D:\PATH_TO_ASSIMP)
cd build
# REPLACE "Visual Studio 12" with your preferred build toolchain (Maybe you want "Codeblocks - MinGW Makefiles")
# BTW VS 10 is VS 2010, VS 11 is VS 2012 and VS 12 is VS 2013, BLAME MicroSoft for the naming! LOL!
cmake -G "Visual Studio 12" ../
# open the generated SLN file (or cbp file if using CodeBlocks) and build!
```
- Copy the DLLs in /lib/_bin/ to /build/Debug/ and /build/Release/
- In Visual Studio, set the Startup project to 3DEngineCpp
- Move the res folder into the build folder
- Run
Major problem is, since I've only done java coding in eclipse I'm a bit confused..
What does he mean by "Open a Terminal and run: '''Shell" ?? and how am I supposed to install glew, sdl2 and assimp? what's cd build? and why do I need CMake, it isn't really mentioned what it does..?
Maybe someone can elaborate (step by step if possible) what I need to do in order to get this running, thanks a lot!
No guarantees my steps will work flawlessly as external dependencies in C++ is still very painful to deal with for me, but I'll give you some leads and hope you make some progress. Also, I've never used Code::Blocks, so I'm not sure if Visual Studio projects are compatible with it. This is the only way I know how to do things on Windows.
First, you'll need to install CMake. CMake is a utility that generates project files so that the project can be easily compiled on certain platforms. It generates Visual Studio project files on Windows, which will allow you to open the project in Visual Studio, and compile them from there.
In order to build the project, you'll have to sort out its dependencies first.
GLEW:
Download GLEW's sources and extract everything. It comes with Visual Studio project files
Open up Visual Studio with Administrator permissions
Open up GLEW's project
Build everything
Run the install "project" to get Visual Studio to install GLEW
Assimp:
Download Assimp's source from GitHub
Extract the project root directory somewhere. The root directory is the directory where CMakeLists.txt is in
Open CMake's GUI utility
Click Browse Source, and select that directory
Select an output directory by clicking Browse Build
Click Configure, when that's done click Generate. This will generate a Visual Studio project file for you
Open project with Visual Studio, build everything. Run install like you did before to install Assimp
SDL2: SDL's sources come with Visual Studio project files, so you can repeat the steps for GLEW to install it.
Now you can finally start attempting to get the engine to work. No guarantees that it'll work, but I'd try the same thing I suggested for Assimp as they're both CMake projects. Once the project files are generated, you can open it up in Visual Studio. Except this time, you won't really be installing it. You can modify the sources and run it like you would any other C++ project.

Intel OpenCL SDK - where are the header files?

I'm trying to use OpenCL on my ultrabook with Iris graphics, therefore I've installed the Intel OpenCL SDK 2013 (the one from here: http://software.intel.com/en-us/vcsource/tools/opencl-sdk).
Trying to do something with it, however I fail to find the directory where the header file (CL/cl.h) is stored... there's no include subdirectory in the install location, and also no headers in the Visual Studio / SDK folders... a search for cl.h on my C: drive also didn't give any results.
What am I doing wrong? Do I have to install anything else to get the headers?
I've only used the AMD OpenCL SDK before, there the headers are neatly located in an include subdirectory of the installation folder...
Turns out the installer didn't run through properly. The last page looked inconspicous and had a nice Finish button, but only the Runtime got installed, but not the Application SDK. The Installer says something like "Installation ended prematurely because of an error" (no more specific information as to what error it was that had occured).
The reason is that the Installer doesn't seem to like my Visual C++ 2010 Express Edition.
Deactivating the "Visual Studio (2010) integration" made the installation be successful, and made the includes turn up.
For me, it's under:
C:\Program Files (x86)\Intel\OpenCL SDK\<version>\include\CL\cl.h
Are you sure the installation was completed successfully? Do you have a bin folder under the OpenCL SDK folder?
For the current version of the SDK, it is at:
C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\include
As installed by intel_sdk_for_opencl_applications_2020.3.494.zip downloaded from https://software.intel.com/content/www/us/en/develop/tools/opencl-sdk.html