Re: linking C++ object files

Bram Moolenaar <[email protected]> Thu, 25 Nov 2004 13:22:11 +0100
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
Luc Hermitte wrote:

> I'm runing into something strange with the latest AAPs (1.068 & 1.072).
> 
> I have a program made of two .cpp files.
> AAP correctly uses "g++ -c" on both of them, but it uses "gcc" to link
> the object files produced/
> According to http://www.a-a-p.org/aapversionlog.html, I understand I
> should not have any problem since theversion 1.031, but I have.
> 
> I'm running aap.bat from cygwin. My main.aap contains:
> 
>     UNITS = realpath 
>     SRC   = cw-$*UNITS
>     TESTS = tests/test_$*UNITS
> 
>     # For cygwin only!
>     :usetool gcc
> 
>     :print tests::BDIR        is $BDIR
>     :print tests -> $TESTS
> 
>     all : $TESTS
> 
>     # ###################################################################
>     # Recipes
> 
>     :program tests/test_realpath : tests/test_realpath.cpp cw-realpath.cpp
> 
> 
> Do I have to specify additionnal libraries, or force the filetype ? Or
> is it a bug ?

Did you try leaving out the ":usetool gcc"?  That seems to avoid the
problem for me.  It's still a problem though, telling Aap to use gcc
should still result in g++ used for linking.  This patch appears to fix
that:

*** tools/gcc.py.orig	Fri Jun 11 16:07:17 2004
--- tools/gcc.py	Thu Nov 25 12:24:52 2004
***************
*** 59,64 ****
--- 59,65 ----
  
      define_action("compile_gxx", 0, """
  	    :buildcheck $OPTIMIZE $?DEBUG
+             :attr {buildaction = build_gxx} $target	# Need to build with $CXX
              :sys $GXX $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` $CXXFLAGS -o $target -c $source
              """,
              outtypes = ["object", "libobject"],


> BTW, is there an AAP compiler-plugin for vim somewhere ?

No, you can simply do:

	:set makeprg=aap

-- 
ARTHUR:          But if he was dying, he wouldn't bother to carve
                 "Aaaaarrrrrrggghhh".  He'd just say it.
BROTHER MAYNARD: It's down there carved in stone.
GALAHAD:         Perhaps he was dictating.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/