The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> C Programming
|
gcc configuration (MinGW)
Discuss gcc configuration (MinGW) in the C Programming forum on Dev Shed. gcc configuration (MinGW) C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

March 15th, 2003, 11:09 AM
|
 |
Contributing User
|
|
Join Date: Jan 2003
Location: USA
|
|
|
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.
|

March 15th, 2003, 11:47 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
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 
|

March 16th, 2003, 02:54 PM
|
 |
Contributing User
|
|
Join Date: Jan 2003
Location: USA
|
|
|
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.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|