|
From: William S. <wil...@gm...> - 2010-11-26 08:05:24
|
I just used the makefile that Keith told me to use...
Sorry for seeming stupid to you, but as I said, I do programming maybe
a total of 14 full days per year. I know enough to get the job done,
and the gnu manuals seem to me to be written in a deliberately
obscurantist way... (I know that is not the case -- just seems that
way). You have to understand that I do not code every day, and I do
not do anything fancy. I do not manage big projects. A program is
typically one or two pages of letter size paper.
Thanks for the help. I will try to figure out why mingw make is
confused about what directory it is in. I am referring to my makefile,
not Keith's. [Keith's did not work at all, as shown in the message
below] Mine [which I also posted here] worked and created librand.a
fine. It just didn't move and del files correctly, looking in the
worng place for them. When I invoke make in a given directory, and my
makefile tells it to move a file from *here* to *there*, it should
know to look *here* for the file to move! It doesn't. It looks in c:\
I never told make to look there. When I start up cmd.exe, the
autorun.bat tells it to start in c:\. Else it starts in something like
...My Documents...
I don't see why that would be the problem, since this is a sensible
place to start, in the search path for everybody. It does not confuse
gcc for example, or any other command I use.
I have been C programming 10 years. As I say, I do simple things, and
my knowledge has been adequate for that under djgpp. I have moved to
mingw and I need to get to the same point I was with djgpp. That is
all I am looking to do.
Thanks again, everyone.
Cheers
Bill
For ref, here is the makefile Keith gave me a couple of posts ago:
==========
You should break this up, into separate build and install rules, (and
for preference, also separate clean rules):
rand: librand.a
CC = gcc
# I made these 2 small changes below to point to the correct directories
libdir = c:/mingw/local/lib
includedir = c:/mingw/local/inlcude
%.o: %.c
$(CC) -c $<
rand.o: rand.c rand.h
librand.a: rand.o # and any other objects you wish it to include
del $@
ar rcvs $@ $^
install:
copy librand.a $(libdir)
copy rand.h $(includedir)
clean:
del *.o
distclean: clean
del *.a
On Thu, Nov 25, 2010 at 11:52 PM, John Brown <joh...@ho...> wrote:
>
> On Thu, 25 Nov 2010 17:08:33 +0000, William Simpson wrote:
>
>
>>
>> OK using the suggested makefile on my rand library, I get:
>>
>> C:\MinGW\local\lib\src\rand>make
>> gcc rand.o librand.a -o rand
>> c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libmingw32.a(main.o):main.c:(.tex
>> t+0xd2): undefined reference to `WinMain@16'
>> collect2: ld returned 1 exit status
>> mingw32-make: *** [rand] Error 1
>>
>
> This command is trying to link rand.o with librand.a to make an executablecalled rand(.exe on Windows). This can't possibly be what you meant to do.
> Since every program must have a main() (or WinMain() for GUI programs),and rand.o does not, the linker complains.
> You really should just Google for a tutorial that explains how to compileprograms with gcc. The gcc manual (available at www.gnu.org) probablywon't help you with that.
> Regards,
> Alias John Brown.
> ------------------------------------------------------------------------------
> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
> Tap into the largest installed PC base & get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with the
> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> _______________________________________________
> MinGW-users mailing list
> Min...@li...
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
> Also: mailto:min...@li...?subject=unsubscribe
>
|