Hello,

* D Haley wrote on Sun, Jul 18, 2010 at 11:11:45PM CEST:
> I have got autotools working for my project under windows and mac, no
> problem; however I am trying to use it under Msys on windows.
> 
> I have a problem where the following command wont work:
> 
> g++ -g -lfoo -lbar  -o myfoo.exe myfoo.o
> 
> this fails with undefined references; however
> 
> g++ -g myfoo.o -lfoo -lbar  -o myfoo.exe 
> 
> works just fine.
> 
> My "solution" is currently to edit the Makefile after ./configure; I modify 
> myfoo_LINK = $(CXXLD) $(myfoo_CXXFLAGS) $(CXXFLAGS) \
>       $(quick3D_LDFLAGS) $(LDFLAGS) -o $@
> to 
> myfoo_LINK = $(CXXLD) $(myfoo_OBJECTS) $(myfoo_CXXFLAGS) $(CXXFLAGS) \
>       $(quick3D_LDFLAGS) $(LDFLAGS) -o $@

The solution is to put -lfoo and -lbar in myfoo_LDADD or in LIBS, not in
*LDFLAGS.  The latter are valid only for other link flags.  See info
Automake Linking.

Cheers,
Ralf

Reply via email to