Build Customization for CUDA 5.0 not found in Visual C++ - visual-studio-2010

I am trying my hand at CUDA gpu programming for the first time and have come across a problem when setting the build customization. I'm not sure if I'm just doing something wrong or not. Basically, when I set the projects build customization to CUDA 5.0, it doesn't work. I try to make a .cu (and even .cpp) file and I get an error stating:
The imported project "C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\BuildCustomization\CUDA
5.0.props"was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
c:\Users\"USER NAME"\documents\visual studio 2010\Projects\"PROJECT
NAME"\"PROJECT NAME".vcxproj
Afterwards the project property page becomes empty with only a Frameworks and References page which is empty. Turning off the CUDA declaration does nothing.
I have tried uninstalling the CUDA toolkit and reinstalling it but to no avail.
I'm pretty new at this, but any help would be appreciated!

In order to use CUDA build customization, some files should be copied to Visual Studio folders, in your case CUDA 5.0.props is missing from
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\BuildCustomization\
In order to fix this, search for CUDA 5.0.props in your C: drive and copy it to the above path.

This happened to me just now and the solution I did was re-run the CUDA installer and make sure to select Visual Studio integration.

This can also happen if you don't have CUDA installed on the machine. This could be quite common for instance you might be using your laptop to develop the project and it has no CUDA card. Anyway to fix this you need to edit the Visual Studio project file .vcxproj (anyone from NVIDIA listening?)
change
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.props" />**
to
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.props" Condition="exists('$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.props')" />
and then
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.targets" />
to
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.targets" Condition="exists('$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.targets')" />
Then right click on the project icon in visual studio and select the reload option, the project should reload, even if you haven't got CUDA installed on that particular machine.
You might have to do some further steps, eg. use #ifdef
to exclude these include files and other cuda code sections.

Related

VS 2019 could not find SDK

I keep getting this error, I am trying to perform the unity MRTK tutorial for hololens 2. I did everything on the first page https://learn.microsoft.com/en-us/windows/mixed-reality/mr-learning-base-02. When I try and run it this error comes up. I have tried to install 10.0.19041.0 through windows but it always kicks to 19041.1 I have installed all the required components in visual studio.
Any help would be appreciated.
Error pic
Installed Vs individual components
Unity Build settings
The problem you met is a bug seemingly caused by vs installer. It happens when Visual Studio is not installed on driver C.
You can see it here:
https://developercommunity2.visualstudio.com/t/HoloLens-2-build-fails-if-Windows-sdk-is/1313568
There are many ways you could do to get through this.
Copy the folder [Windows Kit Root Dir]\10\Extension SDKs\WindowsMobile (For e.g., D:\Windows Kits\10\Extension SDKs\WindowsMobile) to C:\Program Files (x86)\Windows Kits\10\Extension SDKs\. Should solve all of the missing WindowMobile issues.
https://developercommunity.visualstudio.com/t/msb3774-could-not-find-sdk-windowsmobile-version10/402362#T-N474809
Delete the reference to the Mobile SDK in the vxcproj file.
https://stackoverflow.com/a/60600054/9522354
I tried the first method and it worked for me.
I have tried to install 10.0.19041.0 through windows but it always kicks to 19041.1
For how to modify the SDKReference version, you can try following step:
By referring Section 5 of Update your C#/VB projects to use the latest Universal Windows Platform
Right-click your existing project(YourProjectName(Universal Windows)) in solution explorer, then select Unload Project. After the project is unloaded, right-click the project file again and choose to edit the .vcxproj file.
Find "SDKReference" element and change the value of version from "10.0.19041.1" to your version like "10.0.19041.0".
<ItemGroup>
<SDKReference Include="WindowsMobile, Version=10.0.19041.1" />
</ItemGroup>
to
<ItemGroup>
<SDKReference Include="WindowsMobile, Version=10.0.19041.0" />
</ItemGroup>
Besides, since you are using HoloLens2, it is recommended to set the Architecture in the Unity Build Setting window to x64.

Compile VxWorks project in Visual Studio

I have a VxWorks project that compiles under Toronado on my Win7 machine. I am trying to convert the same project to compile in my Visual Studio 2010. I don't need it to complete to where it creates a .o/out file but at least get through all the defines/includes and etc. so I can use Visual Studio's IDE for definition jumping and etc..
I'm at a point where I'm getting a 'undeclared identifier' for "_interrupt" which is included in several include files from the ..\tornado\target\config\ folder.
I'd appreciate any suggestions
Thanks
I would like to comment on this but don't have enough points.
I do the same thing using eclipse instead of visual studio, I don't do anything special to make it work.
It sounds like you are trying to do the link even though you don't want to. Make sure when you create your project you set it up to create a library not an executable, it should do the compile then but no linking.

Visual Studio 2010 , QT and intellisense/highlight error

Hi have a problem with VisualStudio 2010 and the QT5 plugin, it seems that VisualStudio doesnt recognize the QT Library (despite i have installed the plugin and followed the whole procedure).
This is what I see:
https://www.dropbox.com/s/yyzvfev0zoj8x9n/visualstrudel.jpg
So the IDE highlights the QT stuff like if the files were not present, and Intellisense is not working. But, If I compile the application, it compiles without error and works like a charm.
What could be the cause of the highlight/Intellisense issue?
You cannot launch Visual Studio 2010 directly.
You will need to launch the QT 5.0.1 for Desktop(MSVC 2010) command line from Program Files->Qt 5.0.1->5.0.1
After which you will need to run the vcvarsall.bat and devenv after.
x:\program files(x86)\Microsoft Visual Studio 10.0.\VC\vcvarsall.bat
x:\program files(x86)\Microsoft Visual Studio 10.0.\Common7\IDE\devenv.exe
This is applicable to VS2012 and Qt4.5.0, though I believe Qt version does not matter.
I am not sure if it is the same/similar to VS2010, but I stumbled upon this post while looking the answer to the same question for VS2012.
Here is what you can do:
Right-click the project in your solution and select Properties.
Select Configuration Properties -> VC++ Directories.
Edit Include Directories entry.
Add $(QTDIR)\include\QtCore and any other (required by your project) Qt folders to the list (it depends what Qt headers you are using).
This has to be done to every project in your solution that uses Qt, unfortunately.
Now, there is another note:
We were transferring our solution from VS2005 to VS2012 and that problem happened to me when I converted the solution 2005->2012 BEFORE setting the QTDIR environment variable.
When I re-converted the solution again (AFTER *QTDIR* variable was created) the problem didn't appear. So make sure you have this variable before you open/convert your solution for the first time.
Based on the previous note, I believe that some information related to the issue is stored in one of the following files: .sdf and/or .v11.suo.
So closing VS, deleting these files and opening VS again might help. Just back them up before you do it - I haven't tried it myself (I just re-imported the whole solution which generated these files anew).

Setting executable icon in Visual C++ 2010 Express

I'm rather unfamiliar with programming tools in Windows but have been forced to use VC++ 2010 Express for a project recently. We have been working on a piece of software that we didn't start and now we are reaching the finish line. Only problem is that I want to be able to set the executable icon.
Since the project is written mostly in SDL we have set the titlebar icon using the SDL_WM_SetIcon call as recommende on several sites but I still can't find any references to how to set the executable icon. All my google searches has turned up results about Visual Studio 2010 and Visual C++ 2008, neither of which seems appicable.
Since VC++ 2010 Express lacks resource editor but not resource compiler this can be done by manually creating a resource.rc file in the project directory (same as where your .vcxproj files are located), also drop in your .ico version of your icon in the same directory.
In resource.rc add the following line:
IDI_APP ICON "icon.ico"
And add the file, in VC++, to the Resource Files.
Doing this in VC++ should result in something like this to be added to your .vcxproj:
<ItemGroup>
<ResourceCompile Include="resource.rc" />
</ItemGroup>
And to your vcxproj.filters:
<ItemGroup>
<ResourceCompile Include="resource.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
I ran into a similar situation recently with the Express edition.
I came up with a different way to approach this (see gif).
Posting it here in case someone runs into similar problem.

How to add common/inc folder to a CUDA project at Visual Studio?

I want to develop gpu computing algorithms using CUDA. I'm using Visual Studio 2010 Ultimate edition. After I install all the computing tools and SDK with samples, I see under project types "NVIDIA->CUDA->CUDA 4.0 Runtime" choice to start a CUDA project.
The problem is that I can't include source files located at ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.0/Common/inc to work with samples, use header files under GL directory etc. I'm trying to include them using "Additional Include Directories". I'm adding the full path, but it doesn't work. Visual Studio doesn't see those files.
How can I use these files? What should I type in to get these files?
I compiled cutil project under common directory, it solved some error problems while trying to compile samples but it made no use for the issue I stated above.
These are the steps I took to install CUDA into VS2010.
Create a normal project of your choice. (e.g. win32)
Right click the project and choose Build Customizations. If you have installed the tools and SDK correctly you should see a CUDA 4.0 target. (If your project becomes corrupt you may also have to replace the existing ExtensionSetting import in your .vcxproj file)
<ImportGroup Label="ExtensionSettings">
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 4.0.props"/>
</ImportGroup>
Your include path should already be setup, if it is not then add $(CUDA_INC_PATH) to your VC++ include directory.
Add cudart.lib to your Linker additional libraries ensuring that $(CudaToolkitLibDir) is added to the paths.
Create a file and give it the .cu file extension. Right click the file, go to properties and select the Item Type as "Cuda C/C++".
Once sthis i complete you should be able to compile Cuda in VS2010. I may have forgetten some steps, you may need to fiddle abit, I will edit this post if I recall tomorrow.

Resources