gcc configuration under linux advice needed

This is a discussion on gcc configuration under linux advice needed within the Tech Board forums, part of the Community Boards category; I have installed andLinux. Then installed gcc and emacs using apt-get install command they both installed ok. And now the ...

  1. #1
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484

    gcc configuration under linux advice needed

    I have installed andLinux.
    Then installed gcc and emacs using
    apt-get install
    command
    they both installed ok.

    And now the list of questions
    1. Is there any configuration file that I can update with the gcc options so that any time I write in the terminal
    gcc -c file.c
    these options will be applied?

    2. I don't see stdio.h and iostream files on my system. Have I to install some additional packages to get all c/c++ standard libraries and include files?

    3. I'd like to intagrate the gcc and gdb into the emacs. What file should I edit to do it? currently choosing compile menu in emacs I got make -d prompt, I'd like to change it so the command automatically invoked by the emacs will be gcc with options I want

    Thanks
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  2. #2
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    1) You'd have to custom compile GCC over again, with the options you want set. OR you could always alias it out.
    2) /usr/include/stdio.h is where it normal is. Try `find / -name stdio.h` and see what you get. find reports to me that iostream is under /usr/include/c++/<my gcc version>/iostream

    3) Not an emacs user, but it sounds like you need to make a Makefile for the program (within your source directory -- I'd use a new directory for each source).

    EDIT: Corrected my find command.
    EDIT2: Added location of iostream
    Last edited by Kennedy; 01-10-2007 at 12:16 PM.

  3. #3
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    1) Could I find out what options it is compiled now with?
    2) find brings no matches... as I said - havn't found these files on my system
    /usr/include folder contains:
    /X11
    /libglade-1.0
    initreq.h

    and that's all
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  4. #4
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    2) What exactly is "andLinux"? I haven't heard of this version. But, it sounds like you'll need to do some adding of some libraries et al. Perhaps you'll need to install more packages or just download and install GLIBC, BINUTILS, GCC, and company. You may choose to install UCLIBC as well (it is a stripped down version of GLibC -- meaning some functionalitly is not there eg. readdir()).

    1) A gcc --help reveals the following:
    Code:
    Usage: gcc [options] file...
    Options:
      -pass-exit-codes         Exit with highest error code from a phase
      --help                   Display this information
      --target-help            Display target specific command line options
      (Use '-v --help' to display command line options of sub-processes)
      -dumpspecs               Display all of the built in spec strings
      -dumpversion             Display the version of the compiler
      -dumpmachine             Display the compiler's target processor
      -print-search-dirs       Display the directories in the compiler's search path
      -print-libgcc-file-name  Display the name of the compiler's companion library
      -print-file-name=<lib>   Display the full path to library <lib>
      -print-prog-name=<prog>  Display the full path to compiler component <prog>
      -print-multi-directory   Display the root directory for versions of libgcc
      -print-multi-lib         Display the mapping between command line options and
                               multiple library search directories
      -print-multi-os-directory Display the relative path to OS libraries
      -Wa,<options>            Pass comma-separated <options> on to the assembler
      -Wp,<options>            Pass comma-separated <options> on to the preprocessor
      -Wl,<options>            Pass comma-separated <options> on to the linker
      -Xassembler <arg>        Pass <arg> on to the assembler
      -Xpreprocessor <arg>     Pass <arg> on to the preprocessor
      -Xlinker <arg>           Pass <arg> on to the linker
      -combine                 Pass multiple source files to compiler at once
      -save-temps              Do not delete intermediate files
      -pipe                    Use pipes rather than intermediate files
      -time                    Time the execution of each subprocess
      -specs=<file>            Override built-in specs with the contents of <file>
      -std=<standard>          Assume that the input sources are for <standard>
      -B <directory>           Add <directory> to the compiler's search paths
      -b <machine>             Run gcc for target <machine>, if installed
      -V <version>             Run gcc version number <version>, if installed
      -v                       Display the programs invoked by the compiler
      -###                     Like -v but options quoted and commands not executed
      -E                       Preprocess only; do not compile, assemble or link
      -S                       Compile only; do not assemble or link
      -c                       Compile and assemble, but do not link
      -o <file>                Place the output into <file>
      -x <language>            Specify the language of the following input files
                               Permissible languages include: c c++ assembler none
                               'none' means revert to the default behavior of
                               guessing the language based on the file's extension
    
    Options starting with -g, -f, -m, -O, -W, or --param are automatically
     passed on to the various sub-processes invoked by gcc.  In order to pass
     other options on to these processes the -W<letter> options must be used.
    
    For bug reporting instructions, please see:
    <URL:http://gcc.gnu.org/bugs.html>.

  5. #5
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    http://wiki.gp2x.org/wiki/AndLinux - the linux version created for running under windows
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  6. #6
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Quote Originally Posted by vart
    http://wiki.gp2x.org/wiki/AndLinux - the linux version created for running under windows
    Yes, but why would you want to do that?????? <---- Rhetorical question.

  7. #7
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484

    Cool

    Quote Originally Posted by Kennedy
    Yes, but why would you want to do that?????? <---- Rhetorical question.
    Just to toy a little bit with linux without repartioning my comp, using dual-boots or installing VM-Ware...

    I'm just investigating the possibilities to compile some samples under linux without global reformatting of my computer... Also thinking about switching to linux someday, but before that - want to restore my knoledge about this OS, get familiar with the updates that occured since I last time worked with it, check that I don't loose anything essential for me after switching and so on...

    I've choosen the andLinux - because if on some stage I'll decide to roll back all the changes I made to my system and continue with the current setup - it will require for me not more than regular uninstall of the any other program I'm using...

    <---- Rhetorical answer
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  8. #8
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    I understand not wanting to zap the whole system, but with the availability of USB->ide/sata cables, why wouldn't you just use one of these? You can pick up a USB->etc cable for about 30 USD and a nice sized HD for about 50 USD. . . then just floppy boot into the system. . . in the event that you wanted to switch you're already there. . . otherwise, what a cheap way to backup your stuff.

  9. #9
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    But it means I will not be able to work at the same time with windows and linux... Currently I'm still working with windows and have several lynux windows open to experiment with (several teminals, emacs, lynx etc)
    anyway - currently it is just a toy for me (instead of killing time with Wizardry 8 I'm playing with lynux)

    Thanks for your help, I've found the package containing dev version of the libc6 and successfully compiled and run the "Hello work"...

    Don't know yet how to replace the Sym-link gcc with some "batch-file" containing several options
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  10. #10
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    > Thanks for your help

    Or lack of same. . . sorry I couldn't be better help, but, none-the-less, you welcome.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Job advice needed regarding C++
    By joeyzt in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 06-20-2003, 02:10 AM
  2. Linux Help needed
    By momo20016 in forum C Programming
    Replies: 2
    Last Post: 12-12-2002, 07:20 AM
  3. Who's telling the truth??? Career Advice Needed Badly
    By Ican'tCjax,fl in forum C Programming
    Replies: 1
    Last Post: 11-06-2002, 06:16 PM
  4. advice needed
    By unregisterd in forum C Programming
    Replies: 3
    Last Post: 10-19-2002, 08:04 AM
  5. linux forum is needed.
    By black in forum Linux Programming
    Replies: 2
    Last Post: 07-03-2002, 08:16 PM

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