Reputation:
I'm trying to compile a very simple C application using VS2008. My problem is that the resultant binary requires systems to have .NET installed. No actual code within the project uses .NET functionality, but I get errors during execution on any system that doesn't have .NET.
So, is there anyway to compile using VS2008 so the resultant binary can run on a system without .NET?
Upvotes: 3
Views: 423
Reputation: 414
As others have said, set the "Common Language Runtime support" option to "No Common Language Runtime Support." You said that didn't fix it, so .NET must not be the missing dependency. Have a look at the free Dependency Walker tool. This will show you all of the libraries your app depends on.
Upvotes: 1
Reputation: 11925
In the Project Properties dialog, go to Configuration Properties | General. The option for "Common Language Runtime support" should be set to "No Common Language Runtime Support." Then Rebuild.
EDIT: Also check the Advanced Linker options whose names start with CLR. You shouldn't see any /CLR* settings for those 3 items. If you are using a non-default manifest, make sure it doesn't declare any CLR dependencies either.
Upvotes: 3
Reputation: 248149
Simply create a C/C++ project. At the "New Project" dialog, under Visual C++, you have a bunch of options. All the ones in the CLR subcategory are .NET (C++/CLI), and the Win32 ones (as well as "Empty project") are native C/C++ projects.
You can change this setting on existing projects under project properties -> General -> Common Language Runtime Support.
Edit
It is possible that the problem isn't actually .NET, but the C runtime. In that case, specify the non-DLL versions under project properties -> C/C++ -> Code Generation -> Runtime Library.
(And if that is the case, you could have made things a lot easier for everyone by telling us what you knew, rather than what you'd assumed about the problem. ;))
Upvotes: 3