tags:

views:

82

answers:

3

Are there settings I can adjust in Visual Studio so that it does not compile with any run time library or MFC. I started learning C++ to get away from C#'s .Net, and this is just as bad. When I execute the program in a Windows XP virtual machine I get an error. I can compile without the dependencies in Code::Blocks, but I'm more familiar with VS, and prefer many of it's features over those of Code::Blocks. If you know of to get past this, it would be greatly appreciated. Thanks.

A: 

Unless you write in assembly, every language has some sort of runtime associated with it.

I don't believe you have to use MFC though, you can choose those options when you create the project (Console project, empty project, MFC, etc).

If you post details about the error you get on the XP virtual machine it would also be helpful.

bde
A: 

You didn't say what kind of executable you're trying to produce. Is it command line, windows winforms, etc?

You might also review the NetBeans and Eclipse IDE's for C++ projects.

Jay
+3  A: 

You can simply link to the static version of the CRT; just go into the project properties and specify, for the Release configuration, the "Multithreaded (/MT)" CRT instead of the "Multithreaded DLL (/MD)" (you can leave the debug configuration alone, since you'll run it just on your machine anyway). In this way your executable will depend just from "safe" system dlls; obviously this will make your executable grow quite a bit (for example, a small console application that I needed to work without dependencies grew from ~32 KB to ~200 KB).

If you, instead, just want to go without any standard library, you'll have to enable the "Ignore default libraries" option (or something like that, among the linker options), but keep in mind that in this way you won't have almost any facility.

Matteo Italia
Worth noting that with the statically linked runtime, only the parts of it that you actually use are included. The full runtime library is quite a bit larger than the ~160KB that were added to your app
jalf
This worked, thank you!
Lienau
@jalf: I knew that, but I forgot to mention it; thank you for pointing it out.@Lienau: glad it helped you. :)
Matteo Italia