8

i was wondering how programs like ccleaner and utorrent are made? AFAIK they are written in C++ but they run without the need of .net framework and apparently run on windows 98 as well. How can this be done? Visual c++ requires .net framework to be installed to run the binary file.

While .net framework is free, it can be a hassle and it would probably turn many users away as the setup is 20MB+ and installs several files/registry entries.

luq
  • 258
  • 1
  • 3
  • 8

6 Answers6

19

Visual c++ requires .net framework to be installed to run the binary file.

No, it does not. In fact, C++ and the .NET framework are highly unrelated. You only need the .NET framework if your application is written in C++/CLI, which is far away from regular C++.

If you develop an application in standard C++, you don't need the .NET framework, just the runtime shipped with your toolchain (Visual C++, mingw, whatever). In some cases you can also link to the runtime statically, so you don't even need to distribute DLLs etc.

As for creating GUIs in regular C++, there are toolkits out there. Microsoft offers the bare Windows API, MFC, WTL and there are 3rd party products, like Qt or wxWidgets

Jim Brissom
  • 31,821
  • 4
  • 39
  • 33
4

Create native C++ project, without using CLI. In VC++ Application Wizard you can select any type, except of CLI.

Native C++ project has its own runtime requirements: C/C++ runtime, MFC runtime (if MFC is used), but .NET Framework is not required.

Alex F
  • 42,307
  • 41
  • 144
  • 212
4

When creating the project, set it up as a Win32 project, not a CLR project. That will ensure that you're compiling against the C++ standard rather than the managed C++ variant used for .Net.

andand
  • 17,134
  • 11
  • 53
  • 79
  • Thanks for the feedback. I did try creating a win32 project but it is a lot less straight forward than creating a forms application (which requires .net framework). Forms applications are what I'm familiar with so maybe i'll give it another shot. – luq Sep 28 '10 at 12:54
  • @luq: You've just discovered one of the reasons that .Net is popular. You might want to check out Qt (http://qt.nokia.com ... the LGPL version is free) which offers a library of cross-platform UI tools for standard C++ (i.e. not .Net). It can be used with Visual Studio 2010 or you can use Qt Creator which is a full IDE for C++ development using Qt. – andand Sep 28 '10 at 13:09
2

It's important to understand the difference between native and managed code on Windows. There is basic discussion of that topic on SO here and a deeper dive from a Microsoft person here.

Your concern about taking a dependency on .Net Framework may be out of date - new PCs would have it installed by default since Vista and Windows 7 include it, and many older ones will have it due to existing .Net apps or via Automatic Update from Microsoft - there is some info on .Net version relative penetration rates here.

That said, I would not choose C++/CLI unless you have native/managed code interop requirements - use C++ for native and C# for managed code.

Community
  • 1
  • 1
Steve Townsend
  • 53,498
  • 9
  • 91
  • 140
  • Thanks for the feedback. My main concern is that a good percentage of end users would not have .net framework installed and having to install a 20+MB file to run a considerably smaller application isn't exactly convenient. I'll take a look at the links provided as well since I haven't exactly wrapped my head around the concepts of native and managed code. – luq Sep 28 '10 at 12:55
2

In my opinion .NET framework gives you only high production speed otherwise i hate it.

Use .Net when:

1 - You want speed production

2 - You already program with a team that use .Net

3 - You want portability(only between windows and supporting systems)

Use normal/native win32 programming when:

1 - wants more freedom

2 - wants more control over the system and the program u write

3 - have excess time

Dr. Mina Mounir
  • 314
  • 3
  • 13
0

You can create Win32 applications and also MFC ones with no .NET installed nor required. I have been doing so for years. Such application will not require any pre-installation so running it won't require any Setup.exe but just double clicking the .exe. See also this question.

Michael Haephrati
  • 3,660
  • 1
  • 33
  • 56