Standalone executables

Heya,

I've written a program in C++, which is fairly general I guess. And now I want that program to be compiled into a single exe that I can run on atleast a Windows XP computer without having .NET framework installed on that computer. Is this even possible in any way? If so, I'd greatly appreciate if someone could post a way to go about this or a link to somewhere where it's explained how to go about it. In case it's of any importance: I use VS 2008 (not express) and these are all includes that my program uses: (also namespace std btw)

1
2
3
4
5
6
7
8
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <time.h>
using namespace std;
Yes it's possible but you have to change the linker settings to statically link to the standard library
None of those are .NET related. You shouldn't need the .NET framework on any computer that runs this program.

If you get errors saying the program needs the .NET framework:

1) make a 'Release' build instead of a Debug build
2) search through your any project settings that seem like they link to external libs and disable them. (Things like "Using MFC", "Using ATL", etc, etc -- make sure they're all set to "no")

EDIT: + what Bazzy said XD
Last edited on
Thanks a lot both you guys. I changed "Use of MFC" (under Project Properties -> Configuration Properties -> General) to "Use MFC in a static library" and that did the trick for me I think. I quickly tested it out and it seems to be working, atleast on a USB stick (with MojoPac for a semi-XP environment). The 'old' version of my program doesn't run on that stick because .NET is not installed, and this new version does!

So thanks again everyone, I've got high hopes that it works on the machine I have in mind as well :)
Last edited on
Topic archived. No new replies allowed.