Web lists-archives.com

Re: [Mingw-users] newbie errors




-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 24/11/16 21:06, Ralph Hipps wrote:
> Ok, I know I’m a newb, but I need help getting started on something
> urgent.

FWIW, it may be urgent for you, but likely not for anyone else here;
never assume you'll get a quicker reply by pleading urgency.

> I’ve installed gcc, seems to be working, path is set, etc.

So far, so good.

> I’m getting errors about not finding stuff even tho it’s in the 
> directory my source is in, and I’m in that dir when I invoke the 
> tools. Seems a bit odd. I’m running on Win7 Enterprise.

Not odd at all, if you don't specify it correctly.

> aaspi_file.c has:
> 
> #include <stdio.h> #include <stdlib.h>

System headers; these should be found by system include path search.

> #include "aardvark.h"

Local header; nominally expected in same directory as aaspi_file.c,
but failing that, system include path will also be searched.

> But….
> 
> C:\ash>gcc aaspi_file.c aardvark.h -o prog_ice.exe 
> C:\Users\rhipps\AppData\Local\Temp\cc6bFg5w.o:aaspi_file.c:(.text+0xa0):
>
> 
undefined reference to `aa_spi_write'
> ...more like this snipped... collect2.exe: error: ld returned 1 
> exit status

So, what provides function aa_spi_write()?  I guess it isn't defined
in aaspi_file.c, and you didn't give the linker any clue where to find
it, so linking (i.e. the ld phase of the gcc command) failed.

> C:\ash>gcc aaspi_file.c -l aardvark.dll -o prog_ice.exe 
> c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe:
>
> 
cannot find -laardvark.dll
> collect2.exe: error: ld returned 1 exit status

So, aa_spi_write() and friends are in aardvark.dll?  However,

    -l aardvark.dll

tells ld to search for libaardvark.dll.dll.a, then libaardvark.dll.a,
then aardvark.dll.dll, none of which is right; either omit the -l, or
specify it as -laardvark (without the .dll suffix); also, if you adopt
the latter convention, you likely need "-L. -laardvark", so ld knows
to look for libraries in the current directory, in addition to the
system library path.

> C:\ash>gcc aaspi_file.c -l aardvark.h -o prog_ice.exe 
> c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe:
>
> 
cannot find -laardvark.h
> collect2.exe: error: ld returned 1 exit status

Well, aardvark.h is a header file, not a library; specifying

    -laardvark.h

is just plain wrong, however you look at it.  Please read:

    http://www.mingw.org/wiki/LibraryPathHOWTO

- -- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iQIcBAEBAgAGBQJYN2VYAAoJEMCtNsY0flo/fmoP/2/ACOOcfJh/LK3WwX/ehL5u
weei1SwwscbiijReddhGgV7/a54IdIbS4R6ZpSRwUGdjf9vjP+P1z1ElGJ4IgJrZ
WBzOSb8WfVLGYWhrMDoxLhYd8tz5URg7kWzFk/p5zSz5g8uik8GAD3blFDOW72yo
cSSmuBypSeuKt6VbxFgTDSOrs69LyvRJrO9r3IgHlmu0uK2ooRLxQ/6xHrfpT6pG
KRfpb5cwNbONywAFzaFwy99n6YVzdMQbWK9B5my2CtPdlwKVHKN7tPj1JcZ2JxtV
1KCT2DnaJ9sQt3jm2dJ2rkcvs3d3gaOznhkhtHGpOZrssMzxrwbqUHCS3M142bpL
5t27QmXIhndiRY1lFXbg1/aZ83ltxt4k4Kl8Wq7YoAvPnbS0vTJsHjKV7v9Erxhp
h2TKTy3Pl05qTG3EPW1McasR9S/lQ9/kCC0Saoxq1C/u1f86gznJmSWaZNkei/2p
3UFVXZMN6XyIBSSeFK+7grkFNT6pRErLc2HLOFCw9tFF1xjr6B9d6mRMwQaSJBWB
eleDrQ20MDiclr/NsR6UY2YRdJLYNFKv6v+Q/AH77KypGItE4gkeqH6AzWoywcgk
/vDnLwc1okzduwa911/vZbjyLvjBesHM/LI9Pmf+2QFRcG/neKOQXy2oSKxzRKpx
6gERcCJZ4PXJBZCeoH1x
=iLJe
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

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:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe