views:

436

answers:

5

Hello!

It might be a stupid question, but all of my tries to google this failed. The question is: How can you develop windows applications that don't need a redistributable pre-installed? I want to create applications that run also under older versions of Windows which don't have the .NET Framework or something similar included.

Thank you, eWolf

+6  A: 

First, program in a native language, such as C++, no CLR.

Second, disable manifest and avoid linking external DLLs (such as STDC or MFC).

Pavel Radzivilovsky
+1, even if my belly hurts now.
Alex Bagnolini
So C++ doesn't need a redistributable? Recently, some software installed "Microsoft Visual C++ Redistributable" on my computer. When do you need that component?
eWolf
You need it when programming in C++ CLI, AKA "managed C++", which is a microsoft's C++-like language that is actually a hybrid between C++ and C#.
Pavel Radzivilovsky
It's needed with versions of Visual C++ more recent than 6 if the application is compiled specifying to the linker to use the dll version of the CRT; the other option is to link the CRT statically in the application, but the final exe size will grow.
Matteo Italia
I just want to point out that Matteo Italia provides the correct answer to your question in the comments. If you are developing your application using Visual C++ and don't want to install an extra DLL (the Visual C++ runtime aka CRT) you should configure your project to link to the CRT statically.
Martin Liversage
+3  A: 

What do you mean by older versions of Windows?
The .net Framework is part of Windows since Windows 2003 and .net 1.1.
So if you are targeting Windows Versions newer than Windows 2003, you can be sure that .net is available.

There are also solutions, that automate linking/packaging of .net products, so that you don't need to ship any redistributables etc.

Update:
I just found out that Mono allows you to link the whole runtime into your executable.
They call that feature Bundle.
Read more about that here.

weichsel
Perhaps he means old as in Win9x or Windows 2000 where the presence of .NET isn't guaranteed at all.
Rob
Probably, but he tagged the question with .net and redistributable. So we talk about platforms that have some sort of .net support available.
weichsel
If I develop for .NET, then for the newest version. It doesn't help me much if .NET 1.1 is available...
eWolf
weichsel
+1  A: 

I recommend you use the WTL, which is a lightweight C++ framework. It's only one step above the Win32 API really, so you get small EXEs with few dependencies. WTL requires the ATL framework which you can statically link to, meaning you only need to ship your EXE.

Another framework worth looking at is Qt. However, this does require you ship some DLLs with your application. Qt is a fantastic framework and I think you'll find it more productive than WTL (depending on your application needs of course.)

Rob
This sounds interesting. Which environment would you recommend for C++? Should I use Visual C++ or gcc? Is there some kind of form designer available?
eWolf
I also found interesting the SmartWin++ toolkit, although its development stopped some years ago.
Matteo Italia
If you opt for WTL then use Visual Studio. If you go for Qt then they have a superb C++ IDE (complete with form editor) called Qt Creator.
Rob
+1  A: 
tommieb75
No I don't want to build an application using .NET as this requires a runtime - which I don't want. I'm interested in native applications.
eWolf
@eWolf: Ok. Can you edit your tags accordingly as you have this tagged as .NET I will edit my answer accordingly too.
tommieb75
Oh I'm sorry I didn't want to add the .NET tag.. corrected it.
eWolf
+3  A: 

Use Delphi - although the newer versions of the IDE have some odd bugs, it is easy to create native windows applications that don't need a redistributable. Much easier to use than C++/win32.

Graham
You probably are right, but C++ is a language that generally seems to be worth learning it. For sure it's not easy, but it is pretty fast, I think.
eWolf
If it's just a learning exercise, then of course you can do what you like. I doubt that there's a significant speed difference between a C++ app and a Delphi app though since Delphi allows you to get pretty close to the bare metal, as does C++. The difference is in the development time - a GUI is much quicker and easier to develop in Delphi than a C++ one.
Graham
If you're intent on C++, you can use C++Builder, which is part of the same IDE (if you buy the RAD Studio product). It also can produce applications without any redistributable requirements. (I once won a bet with a network administrator about writing a Windows app that would run from a 1.44MB floppy without an installation and retrieve information via the WinAPI from his database server machine; I did it using Delphi 2 and collected on the bet. <g>)
Ken White
@ken: Cool ;) What kind of database was it?
eWolf