#1
  1. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,174
    Rep Power
    2222

    gcc configuration (MinGW)


    Somewhere, I caught a passing reference to a configuration or definitions file for the C compiler on UNIX and Linux systems. Does anybody know about that file and where it is kept?

    Specifically, I've written a which utility for DOS under Win98 using the MinGW port of gcc. However, in order to open and read directories, I need to explicitly link in the libmingex.a library file. Also, I had to create a getopt library to link in as well.

    If there's a configuration file that I could edit to link those in automatically, that would help. And of course, since I'm doing more programming under Linux too, it would help me to know where that is under Linux as well.

    Thank you.
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    Normally, this is the sort of thing you should put in the Makefile for each project, telling it to link to additional libraries. However, if you wish to fix the config file itself, I believe it's the specs file you're looking for. To find out where it is, type:
    gcc --print-search-dirs

    This should print out a bunch of directories under different categories. Within that, look for the category that says "install:" and go to the directory under that category. Within that dir, you should find a file called specs, which contains the defaults. You can edit it and under the section for *lib: you should find some entries that link to libc, such as:
    %{shared: -lc}
    %{!profiled: -lc}
    etc.

    Add your libs here next to the entries for libc:
    %{shared: -lc -lmingex -lgetopt} %{!profiled: -lc -lmingex -lgetopt}
    etc.

    That should make the linker use the two additional libraries in the default as well. For more information on the format of the specs entries, you can try googling for gcc and specs. Hope this helps :)
  4. #3
  5. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,174
    Rep Power
    2222
    Thanks, that did the trick.

    My main motivation was to keep from having to include the getopt library which I had to create myself since Mingw (a Win32 port) did not include it. But that also expanded my knowledge of how gcc is set up, which should come in handy as I work more with Linux.

IMN logo majestic logo threadwatch logo seochat tools logo