|
From: John B. <joh...@ho...> - 2010-11-25 10:35:53
|
Hello Bill, On Thu, 25 Nov 2010 08:19:56 +0000, William Simpson wrote: ... > > I am trying to migrate from djgpp (a species of gnu c compiler) under > DOS to mingw under Windows XP. Sorry for my questions. I really have > looked and it is difficult to find the info I need. > > From: > > http://www.mingw.org/wiki/IncludePathHOWTO > http://www.mingw.org/wiki/SpecsFileHOWTO > > it seems I have a few options. > > Under djgpp I did as follows, for a library I wrote called rand. I > have djgpp\lib\src\rand\rand.c > I have the source rand.c, the header rand.h, and the makefile there. > In the makefile I have > rand: rand.c > gcc -c rand.c > ar rvs librand.a rand.o > del rand.o > move librand.a \djgpp\lib > copy rand.h \djgpp\include > > Then subsequently I put #include "rand" at the top of any program that > uses it and put -lrand in my makefile when I compile it. > > First, I think that for mingw I need to put a "\" at the ends of the > lines like so: > rand: rand.c > gcc -c rand.c \ > ar rvs librand.a rand.o \ > del rand.o \ > move librand.a \djgpp\lib \ > copy rand.h \djgpp\include > No trailing slash is required. > By analogy, maybe in mingw I would do: > move librand.a c:\mingw\lib \ > copy rand.h c:mingw\include > > I am not at all sure about: > ar rvs librand.a rand.o \ > Other than the trailing \, this is correct. > >>From what I read, one possibility is to stick the libraries in > c:\mingw\local > or maybe c:\mingw\local\lib ? > This seems nice, because it keeps my libraries separate from mingw's. I normally do this, but if you want to keep your libraries separate from mingw's, then you should keep the header files separate too. > Would mingw be smart enough to know to look there? Otherwise I guess I > would need to set LIBRARY_PATH? How? Use the -I and -L flags when you compile programs that use your libraries. gcc -I \path\to\headers -L\path\to\libraries etc. Run 'gcc -v --help' for help generally. > > How about the header files? Where do they go? > c:\mingw\local > c:\mingw\local\include ? > Would mingw be smart enough to know to look there? Maybe there's an > INCLUDE_PATH? See above. > > Fiddling with Specs seems an option too, but it is too sketchy for me > to figure out. > I would leave the specs file alone. You don't have to do anything different if you don't want to. > Any tips appreciated!! > > Thanks very much > Bill > Regards, Alias John Brown. |