mirror of
https://github.com/boostorg/build.git
synced 2026-02-08 22:52:26 +00:00
* Moved XML sources to src * Added reference.css from Reece Dunn to html dir * Added images from boost/doc/html so that local builds look ok [SVN r22175]
83 lines
2.4 KiB
XML
83 lines
2.4 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE chapter PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
|
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
|
|
|
<chapter id="bbv2.faq">
|
|
<title>Frequently Asked Questions</title>
|
|
|
|
<section>
|
|
<title>
|
|
I'm getting "Duplicate name of actual target" error. What
|
|
does it mean?
|
|
</title>
|
|
|
|
<para>
|
|
The most likely case is that you're trying to
|
|
compile the same file twice, with almost the same,
|
|
but differing properties. For example:
|
|
|
|
<programlisting>
|
|
exe a : a.cpp : <include>/usr/local/include ;
|
|
exe b : a.cpp ;
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
The above snippet requires two different compilations
|
|
of 'a.cpp', which differ only in 'include' property.
|
|
Since the 'include' property is free, Boost.Build
|
|
can't generate two ojects files into different directories.
|
|
On the other hand, it's dangerous to compile the file only
|
|
once -- maybe you really want to compile with different
|
|
includes.
|
|
</para>
|
|
|
|
<para>
|
|
To solve this issue, you need to decide if file should
|
|
be compiled once or twice.</para>
|
|
|
|
<orderedlist>
|
|
<listitem>
|
|
<para>Two compile file only once, make sure that properties
|
|
are the same:
|
|
|
|
<programlisting>
|
|
exe a : a.cpp : <include>/usr/local/include ;
|
|
exe b : a.cpp : <include>/usr/local/include ;
|
|
</programlisting></para></listitem>
|
|
|
|
<listitem><para>
|
|
If changing the properties is not desirable, for example
|
|
if 'a' and 'b' target have other sources which need
|
|
specific properties, separate 'a.cpp' into it's own target:
|
|
|
|
<programlisting>
|
|
obj a_obj : a.cpp : <include>/usr/local/include ;
|
|
exe a : a_obj ;
|
|
</programlisting></para></listitem>
|
|
|
|
<listitem><para>
|
|
To compile file twice, you can make the object file local
|
|
to the main target:
|
|
|
|
<programlisting>
|
|
exe a : [ obj a_obj : a.cpp ] : <include>/usr/local/include ;
|
|
exe b : [ obj a_obj : a.cpp ] ;
|
|
</programlisting></para></listitem>
|
|
|
|
</orderedlist>
|
|
|
|
<para>
|
|
A good question is why Boost.Build can't use some of the above
|
|
approaches automatically. The problem is that such magic would
|
|
require additional implementation complexities and would only
|
|
help in half of the cases, while in other half we'd be silently
|
|
doing the wrong thing. It's simpler and safe to ask user to
|
|
clarify his intention in such cases.
|
|
</para>
|
|
|
|
</section>
|
|
|
|
</chapter>
|