luq
luq

Reputation: 258

how to create c++ programs without the requirement of .net framework to run (like ccleaner and utorrent)

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.

Upvotes: 8

Views: 18194

Answers (6)

Michael Haephrati
Michael Haephrati

Reputation: 4215

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.

Upvotes: 0

Steve Townsend
Steve Townsend

Reputation: 54128

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.

Upvotes: 2

Dr. Mina Mounir
Dr. Mina Mounir

Reputation: 315

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

Upvotes: 2

andand
andand

Reputation: 17487

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.

Upvotes: 4

Jim Brissom
Jim Brissom

Reputation: 32919

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

Upvotes: 19

Alex F
Alex F

Reputation: 43311

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.

Upvotes: 4

Related Questions