Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VS2005, C++ and native code

Status
Not open for further replies.

Akusei

Programmer
Jul 15, 2003
90
US
I have a question regarding the development of native C++ executables within Visual Studio 2005.

In past versions of of VS, like version 6, you could build your executable and most all OS' would have the msvcrt.dll and whatever other files needed to run the executable in a stand alone manor.

It has come to my attention that building a "stand alone" exe with VS2005 may not be possible at this point. Even though I am developing in a purely "native" capacity, the executable still does some funky .net stuff in the background (with manifests, something called side-by-side assemblies and something to do with isolation). After installing the .net 2.0 framework on the target machine the exe ran perfectly.

I tried disabling some options with the project; like telling it not to embed a manifest and saying no to isolation. This only makes the exe dead in the water, saying stuff like it loaded c runtimes incorrectly or something to that effect.

Does anyone know if .NET 2.0 is required on the target machine for native C++ exes to run properly, or is there some way to get around this?

Best regards,
Nathan Martini
 
Works fine for me. I think it's the "Common Language Runtime" option in the Project Settings that you need to disable.
 
Thanks for the reply, but no go. I have the "Common Language Runtime support" option set to "No Common Language Runtime support" and I still have the same issues. Any other ideas?
 
When you create a project, do you start off by choosing a CLR project, or by choosing a Win32 project?
 
I choose Win32 project. I have already solved the problem. Along with what I've already done with turning off the isolation and not generating or embedding the manifest, you need to set Configuration Properties->C/C++->Code Generation->Runtime Library to Multi-Threaded (/MT) instead of Multi-Threaded DLL (/MD).

Thanks everyone
 
so does that change make it to depend on the plain msvcrt.dll instead of the msvcr80.dll?
 
From what I can tell, yes... but I may be mistaken.
 
/MT option: use static linkage with RTL modules, so an application does not depends on msvcrt.dll (i.e. on user computer environment - all in one mode). Compare exe sizes...
 
Yeah, I just found that out. /MT includes everything the program needs to run within the exe so it doesn't depend on anything else. That makes the exe much bigger. But is it true that /MT includes only what the program needs and not everything that the dll contains? If that is true, then you save space in the end instead of including the entire dll.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top