| View previous topic :: View next topic |
| Author |
Message |
kot1990 Expert Cheater
Reputation: 1
Joined: 06 Sep 2009 Posts: 131 Location: Greece
|
Posted: Wed Dec 30, 2009 3:22 pm Post subject: How to compile without net framework? |
|
|
Everything I compile requires net framework to run. How can I avoid this?
Edit: I compile with Visual Studio 2008. I searched in compiler settings but I can't understand them.
Last edited by kot1990 on Wed Dec 30, 2009 3:30 pm; edited 1 time in total |
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Wed Dec 30, 2009 3:29 pm Post subject: |
|
|
| By not using a language that requires it for operation...
|
|
| Back to top |
|
 |
kot1990 Expert Cheater
Reputation: 1
Joined: 06 Sep 2009 Posts: 131 Location: Greece
|
Posted: Wed Dec 30, 2009 3:33 pm Post subject: |
|
|
| I create simple console application in C/C++ and on computer that has not net framework it won't run, I compile in release mode . When I compile with devc++ it runs but the application is larger in file size. In VS it gives a release file of 4kb but in devc++ is 22kb. Ow, I forgot to mention that I create an empty project without any dependencies.
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Dec 30, 2009 3:50 pm Post subject: |
|
|
look in project settings -> C/C++ -> code generation
you're probably using dll
|
|
| Back to top |
|
 |
kot1990 Expert Cheater
Reputation: 1
Joined: 06 Sep 2009 Posts: 131 Location: Greece
|
Posted: Wed Dec 30, 2009 4:01 pm Post subject: |
|
|
Ok thx, now I am at work now, when I go home I will try that.
Edit: Thx slovach I found it. For anyone who has the same issue: project propeties -> C/C++ -> code generation and change runtime library from Multi-Threaded DLL (MD) to just Multi-Threaded (MT) and recompile. But there's nothing about net framework there . How will someone know that? and most maybe ignore that because when you install visual studio packets like net framework are autoinstalled, but when you want to run your program on another computer a strange error appears on runtime, what the....
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Wed Dec 30, 2009 9:49 pm Post subject: |
|
|
Don't use the managed framework?
New Project -> C/C++ -> Win32 -> Console
Compile with the code generation multi-threaded and the user won't even need the visual c++ redistributable libraries.
_________________
|
|
| Back to top |
|
 |
igoticecream Grandmaster Cheater Supreme
Reputation: 0
Joined: 23 Apr 2006 Posts: 1807 Location: 0x00400000
|
Posted: Wed Dec 30, 2009 10:23 pm Post subject: |
|
|
| kot1990 wrote: | | I create simple console application in C/C++ and on computer that has not net framework it won't run |
are you using unmanaged C++ right?
_________________
+~ |
|
| Back to top |
|
 |
kot1990 Expert Cheater
Reputation: 1
Joined: 06 Sep 2009 Posts: 131 Location: Greece
|
Posted: Thu Dec 31, 2009 5:18 am Post subject: |
|
|
| igoticecream wrote: | | are you using unmanaged C++ right? |
managed is the one that uses .net framework right? Yea I am using unmanaged C++, I want to compile an executable that will run directly, not bytecode or other shit. Which one is better/faster?
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Thu Dec 31, 2009 6:02 am Post subject: |
|
|
| kot1990 wrote: | | change runtime library from Multi-Threaded DLL (MD) to just Multi-Threaded (MT). | That's not .NET framework. That's the CRT, C Runtime library. To avoid that add /nodefaultlib to your linker, define your own mainCRTStartup()/WinMainCRTStartup(), make sure that the exceptions are off, and dynamically link the runtime library.
Also, if I were you, I'd avoid static linking to the runtime library, because it makes your exe huge and is waste of space.
EDIT: Oh right, remember that you'll lose all the CRT functionality, so better to stick to winapi :)
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Thu Dec 31, 2009 6:14 am Post subject: |
|
|
pretty sure that the CRT is actually a standard system file, so you shouldn't actually run into trouble doing that in most cases. maybe, though it's a pretty common 'trick' for getting very tiny exe's.
don't think you can rely on this with the CPRT though
|
|
| Back to top |
|
 |
kot1990 Expert Cheater
Reputation: 1
Joined: 06 Sep 2009 Posts: 131 Location: Greece
|
Posted: Thu Dec 31, 2009 6:30 am Post subject: |
|
|
| Jani wrote: | That's not .NET framework. That's the CRT, C Runtime library. To avoid that add /nodefaultlib to your linker, define your own mainCRTStartup()/WinMainCRTStartup(), make sure that the exceptions are off, and dynamically link the runtime library.
Also, if I were you, I'd avoid static linking to the runtime library, because it makes your exe huge and is waste of space.
EDIT: Oh right, remember that you'll lose all the CRT functionality, so better to stick to winapi  |
lol you're right.,, what is requiered is C++ redistributable package by microsoft and not net. framework xD. Explain a little better what is a runtime library, I don't understand and why is necessary? It sounds like somethink that is required for the program to run in runtime, but what it contains and what it does?
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Thu Dec 31, 2009 6:51 am Post subject: |
|
|
| slovach wrote: | | pretty sure that the CRT is actually a standard system file, so you shouldn't actually run into trouble doing that in most cases. | Depends on what are you writing. If you're able to code in WinAPI only, you're fine without it. And everything on Windows should be doable in WinAPI.
| kot1990 wrote: | | Explain a little better what is a runtime library, I don't understand and why is necessary? It sounds like somethink that is required for the program to run in runtime, but what it contains and what it does? | If you use any standard C functions, you'll be using the runtime lib. If you stick to WinAPI, you'll be fine without it. CRT is the lib implementing the C standard library.
Also, check the WinAPI equivalents and here's a nice site.
|
|
| Back to top |
|
 |
kot1990 Expert Cheater
Reputation: 1
Joined: 06 Sep 2009 Posts: 131 Location: Greece
|
Posted: Thu Dec 31, 2009 11:41 am Post subject: |
|
|
| thank you for all this info. So runtime libraries are like dlls.
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Thu Dec 31, 2009 3:27 pm Post subject: |
|
|
If you're using C++, you won't even touch those functions. If you're using C, you should stop using the worst C compiler on the planet.
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Thu Dec 31, 2009 6:11 pm Post subject: |
|
|
| Jani wrote: | | slovach wrote: | | pretty sure that the CRT is actually a standard system file, so you shouldn't actually run into trouble doing that in most cases. | Depends on what are you writing. If you're able to code in WinAPI only, you're fine without it. And everything on Windows should be doable in WinAPI.
| kot1990 wrote: | | Explain a little better what is a runtime library, I don't understand and why is necessary? It sounds like somethink that is required for the program to run in runtime, but what it contains and what it does? | If you use any standard C functions, you'll be using the runtime lib. If you stick to WinAPI, you'll be fine without it. CRT is the lib implementing the C standard library.
Also, check the WinAPI equivalents and here's a nice site. |
Many of the Windows functions rely on the CRT afaik
HeapAlloc ultimately calls malloc()
so does new in C++ I think.
you can go hog wild by linking against msvcrt.lib
|
|
| Back to top |
|
 |
|