Why isn't Visual Studio 2010 recognizing CUDA functions? - c

I just got the CUDA drivers and the CUDA toolkit 4.2 installed onto my machine with all of the standard options. I have a CUDA capable NVIDIA GPU.
For some reason, the Visual Studio compiler, despite having the CUDA files located in the Program Files/MSBuild/Microsoft.cpp/v4.0/BuildCustomizations, will not compile a simple kernel function:
__global__ void kernel(void){
//I do nothing :(
}
It registers a type specifier error on the __global__.
Is there something more that I have to do?
Also, I have been having some trouble (IDE's and I are never compatible) with Visual Studio and its want to create a ton of files. I added all of the source and header files by "Add" and selecting "Existing File," so I believe that my source files are not with Visual Studio's plethora of files.
Thank you in advance.

Did you enable CUDA build customizations and did you name your CUDA file with a ".cu" extension? To get to the build customizations in Visual Studio 2010, right click the CUDA project in the Solution Explorer and select Build Customizations.

Related

Compiling a Visual Studio dll and using it with cygwin

my question is very simple.
I'm dealing with portaudio with the support of ASIO drivers for a university assignment. With Visual Studio I managed to compile everything an also to create a dll and now I must do the same but with cygwin. Is it possible to use the dll created with Visual Studio 2019 with cygwin? If it isn't, there is a way to do it?
Thanks in advance
Yes, you must have myfile.h myfile.dll and myfile.lib .
your goal is to produce myfile.a and put it in lib directory.
For that there is a tool Lib2a that take myfile.dll and myfile.lib in input and give myfile.a file.
https://code.google.com/archive/p/lib2a/downloads

Can Visual Studio 2019 pack the DLLs it requires in just a small .exe file?

I made a Windows application with C++ WinAPI by using Visual Studio 2019.
After finishing, I built it, and executed with my computer. It works perfectly.
Then I sent to my friend who didn't have Visual Studio. It said that it needs "msvcp140d.dll" "ucrtbased.dll" "vcruntime140_1d.dll" "vcruntime140d.dll" to open it.
Then I found them in my computer, put them in the same dir with my application, and sent them to my friend. It worked fine, too.
But My question is "Is there any way to pack them with just Visual Studio 2019?" A small application with lots of DLLs is just a little bit weird.
First you're sending the wrong files. Files with d suffix like that are for debugging only and must not be distributed
You cannot redistribute all of the files that are included in Visual Studio; you are only permitted to redistribute the files that are specified in Redist.txt or the online "REDIST list." Debug versions of applications and the various Visual C++ debug DLLs are not redistributable. For more information, see Choosing a Deployment Method.
Determining Which DLLs to Redistribute
Final executable files must be compiled in release mode and use the release version of those DLLs. Don't give out debug binaries. They're seriously slow due to the logics added for debugging purposes
And you don't actually need to send the DLLs but you should tell the user to install the corresponding VC redistributable package. It's the runtime (CRT) for Visual Studio projects containing functions like printf, memcpy... for you. You don't need to find any other DLL if you don't use any DLLs in the project
It's also possible to link the runtime library statically by changing the option /MD to /MT. That way the final exe file will be self-contained (no need for additional runtime DLLs) but it'll also be larger and you lose the ability to use the newer library functions when the package is updated to fix bugs or performance issues. Again, you must compile in release mode regardless of whether you're linking statically or dynamically
See also
Compile to a stand-alone executable (.exe) in Visual Studio
Compile C in Visual Studio 2012 without MSVCRT runtime
How to make a Single Executable VS 2010

Visual Studio Code does not include C header files

I recently downloaded Visual Studio Code to begin learning the C programming language. I installed the program as well as the C extension. However, when I tried to create the "Hello, World!" program, it would not run, and in the Problems menu it did not recognize the stdio.h header file, saying that I need to update my includePath. I have not been able to find any stdio.h file on my computer to link to. Do I need to download the C library files (even though I have read they should be included with the compiler), and if so, where can I find them? Or is there another solution? Thanks, and sorry if this is a stupid question, I am new to this.
I think you might be confusing VS Code with the VS IDE.
VS Code is a source editor only; that is to say that it's basically just a glorified text editor. It has the ability to load extensions and open a shell to compile the code, and there are a few extensions that let you debug the code itself, but they can be tricky to get setup and installed to work well with C/C++ code. VS Code does not have a compiler/assembler/linker nor the requisite headers or SDK's as that is up to you (the user) to install and then point to those in your settings file.
The Visual Studio IDE, on the other hand, is a complete integrated development environment that also includes the system headers and SDK's for Windows, as well as the binaries to properly compile, link and assemble your code into a binary for a Windows system (cross platform is possible as well). The Visual Studio IDE comes in many different flavors with the latest being VS 2017.
If you wish to stick with VS Code, you'll need to grab a compiler and the appropriate header files for the system you're targeting. If you wish to just stick with Windows for now, you can grab the Windows 7 SDK here or the Windows 10 SDK here .. you could even grab both and just reference the one you wish when you want. Note that the Windows 7 SDK includes the Microsoft C/C++ compiler, alternatively you can download the MSVC compiler from their Build Tools site.
There's also Cygwin in which you can use the GNU compiler, and of course Clang, which can be referenced in both VS Code and the VS IDE.
I hope that can help.

Adding CUDA to WFA

I'm trying to use cuda kernels(some of CUPTI samples included in Cuda Toolkit to get info about GPU and performance) in WFA application.
How I should do it?
When I try to add .cu file it shows me this type of errors:
"this declaration has no storage class or type specifier"
The things that are underlined are cuda include files and therefore other cuda elements.
Just to be clear I can run CUDA runtime projects, and cuda applications - it causes no problem.
I'm using win 7, visual studio 2010, I have newest Toolkit, drivers, and Nsight.
In solution explorer you click right on you project and choose "Build Customizations..." and then you check "CUDA 4.X(.targets,.props)".

Compile lighttpd in Visual Studio 2005

I have a platform independent source code that can run on Windows and UNIX platforms. To compile the source on Windows, there is support for cygwin. But I want to compile it with Visual Studio 2005. How will I do it? What are the project settings required to be done on Visual studio and what about linking options? Will I be able to get any idea from successfully compiled source on cygwin? BTW, source code is in C language. Please someone help me on this.
Thanks in advance!
IMHO you're out of luck. If this project depends on cygwin, you most probably can't compile it with reasonable effort in vs.
Basically (for simple libraries) you should be fine by dumping all the .c and .h files into a visual studio project.
Most of the time you can just drop it to your own sources. If you want to create a library choose create new project -> new library, put all the sourcefiles in there and the library will automatically be linked with your main program.

Resources