willbend Skrevet 9. april 2005 Del Skrevet 9. april 2005 Når jeg kompilerer dette: #include <iostream> using namespace std; int main() { cout<<"Hallo verden"; } Med Dev-C++ 4.9.9.2 blir exe filen 464 kB. Hvorfor blir den så stor ? Lenke til kommentar
Herr_Dude Skrevet 9. april 2005 Del Skrevet 9. april 2005 Kanskje du compilerer den i debug version (inneholder også data for debug info). Bruker ikke dev-c++ selv, men antageligvis kan du endre et sted, slik at du bygger det i release versjon istedet. Lenke til kommentar
knuto Skrevet 9. april 2005 Del Skrevet 9. april 2005 Hmm. Dette har eg aldri tenkt over, men det er jo faktisk slik her og, til trass for at debugging information er deaktivert. Lenke til kommentar
Dead_Rabbit Skrevet 9. april 2005 Del Skrevet 9. april 2005 Du kan sikkert optimalisere den for slik at filen blir mindre.. Men da kjører programmet saktere om jeg ikke husker helt feil. Tror det er optimaliserings-nivå 2 som er vanligst å bruke for release versjonen av programmet ditt. Lenke til kommentar
kyrsjo Skrevet 9. april 2005 Del Skrevet 9. april 2005 Det med filstørrelse og optimalisering er et toegget sverd - da ikke alt minne er skapt likt. Ofte vil det lønne seg å optimere for *størrelse* - ikke for hastighet - og slik unngå for mye lesing fram og tilbake fra "treg" RAM. Forøvrig - GCC's optimaliserings-nivåer (fra "man gcc"): Options That Control Optimization These options control various sorts of optimizations. Without any optimization option, the compiler’s goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter to any other statement in the function and get exactly the results you would expect from the source code. Turning on optimization flags makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program. Not all optimizations are controlled directly by a flag. Only opti- mizations that have a flag are listed. -O -O1 Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function. With -O, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time. -O turns on the following optimization flags: -fdefer-pop -fmerge-constants -fthread-jumps -floop-optimize -fcrossjumping -fif-conversion -fif-conversion2 -fdelayed-branch -fguess-branch-probability -fcprop-registers -O also turns on -fomit-frame-pointer on machines where doing so does not interfere with debugging. -O2 Optimize even more. GCC performs nearly all supported optimiza- tions that do not involve a space-speed tradeoff. The compiler does not perform loop unrolling or function inlining when you specify -O2. As compared to -O, this option increases both compi- lation time and the performance of the generated code. -O2 turns on all optimization flags specified by -O. It also turns on the following optimization flags: -fforce-mem -fopti- mize-sibling-calls -fstrength-reduce -fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse -fgcse-lm -fgcse-sm -fdelete-null-pointer-checks -fexpen- sive-optimizations -fregmove -fschedule-insns -fschedule-insns2 -fsched-interblock -fsched-spec -fcaller-saves -fpeephole2 -fre- order-blocks -freorder-functions -fstrict-aliasing -falign-func- tions -falign-jumps -falign-loops -falign-labels Please note the warning under -fgcse about invoking -O2 on pro- grams that use computed gotos. -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2 and also turns on the -finline-functions and -frename-regis- ters options. -O0 Do not optimize. This is the default. -Os Optimize for size. -Os enables all -O2 optimizations that do not typically increase code size. It also performs further optimiza- tions designed to reduce code size. -Os disables the following optimization flags: -falign-functions -falign-jumps -falign-loops -falign-labels -freorder-blocks -fprefetch-loop-arrays If you use multiple -O options, with or without level numbers, the last such option is the one that is effective. Options of the form -fflag specify machine-independent flags. Most flags have both positive and negative forms; the negative form of -ffoo would be -fno-foo. In the table below, only one of the forms is listed---the one you typically will use. You can figure out the other form by either removing no- or adding it. The following options control specific optimizations. They are either activated by -O options or are related to ones that are. You can use the following flags in the rare cases when ‘‘fine-tuning’’ of opti- mizations to be performed is desired. ... mer her, flere detaljer Lenke til kommentar
Mantion Skrevet 10. april 2005 Del Skrevet 10. april 2005 iostream blåser opp filene 200 kb i dev, dette er svært irriterende! Så hvis du finner en annen metode å printe ut tekst på, bruk det gjerne ( I hvert fall når det er et så enkelt program! )... En annen metode som står beskrevet over, men uansett tar den med er å bruke -s i linker menyen.... Lykke til! Mantion Lenke til kommentar
JBlack Skrevet 10. april 2005 Del Skrevet 10. april 2005 Mest sansynlig statisk linking. Prøv dynamisk linking i stedet. Lenke til kommentar
Anbefalte innlegg
Opprett en konto eller logg inn for å kommentere
Du må være et medlem for å kunne skrive en kommentar
Opprett konto
Det er enkelt å melde seg inn for å starte en ny konto!
Start en kontoLogg inn
Har du allerede en konto? Logg inn her.
Logg inn nå