gcc3.2

This is a discussion on gcc3.2 within the Linux Programming forums, part of the Platform Specific Boards category; I think that gcc3.2 produces very big binaries. Even very small program likes cout<<"Hello world.\n"; Binary is as big as ...

  1. #1
    still a n00b Jaguar's Avatar
    Join Date
    Jun 2002
    Posts
    187

    gcc3.2

    I think that gcc3.2 produces very big binaries.
    Even very small program likes cout<<"Hello world.\n";
    Binary is as big as 300-400 Kb.
    What happen? How can I minimize it?

    One more question, I usually write myheader.h. If I want to compile the header (just for check syntax or mis-spelling, not to run), how can I do with gcc/g++ (which options)?

    Thanks in advance
    slackware 10.0; kernel 2.6.7
    gcc 3.4.0; glibc 2.3.2; vim editor
    migrating to freebsd 5.4

  2. #2
    still a n00b Jaguar's Avatar
    Join Date
    Jun 2002
    Posts
    187
    (I guess you misread the file size) - 4MB (4090156b) for a simple ``hello world''!
    I put some commands

    $ du my_bin
    438 my_bin
    $
    $ du -b my_bin
    448512 my_bin

    I dont think I misread it. And I tried...

    $ nm my_bin
    I guess tonnes of library are in my_bin.
    slackware 10.0; kernel 2.6.7
    gcc 3.4.0; glibc 2.3.2; vim editor
    migrating to freebsd 5.4

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    244
    Uhh, my executables aren't nearly that large when I compile with gcc 3.2. For example, an SDL prog I have is 32kb, which includes SDL.h, iostream, and my own matrix library.

    I'm not sure why you are all getting such large files.

  4. #4
    still a n00b Jaguar's Avatar
    Join Date
    Jun 2002
    Posts
    187
    What's your cout-size if you compile with ``-s''?
    $ g++ -s -o my_bin my_file.cpp
    $
    $ du -b my_bin
    219316 my_bin
    slackware 10.0; kernel 2.6.7
    gcc 3.4.0; glibc 2.3.2; vim editor
    migrating to freebsd 5.4

  5. #5
    still a n00b Jaguar's Avatar
    Join Date
    Jun 2002
    Posts
    187
    Yes I still have gcc2.95, I cant remember how many C/C++ compilers I have (may be 3 compilers per one partition, I have total 4 partitions. Joking dont believe me. But now I use only gcc3.2 on cygwin and gcc2.96 on redhat7.2. Once I was told to use gentoo linux and FreeBSD but I am scared.
    Anyway, I shall try, if I have a chance.
    Thanks
    slackware 10.0; kernel 2.6.7
    gcc 3.4.0; glibc 2.3.2; vim editor
    migrating to freebsd 5.4

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21