<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Kompilierfehler bei boost::regex]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe ein laengeres, kompilierfaehiges Programm, bei dem ich boost::regex mittels</p>
<pre><code class="language-cpp">#include &lt;boost/regex.hpp&gt;
</code></pre>
<p>in <a href="http://main.cc" rel="nofollow">main.cc</a> einbinde. Der Anfang von <a href="http://main.cc" rel="nofollow">main.cc</a> sieht wie folgt aus (Details sind hier nicht wichtig):</p>
<pre><code class="language-cpp">#include &quot;standard.h&quot;

#include &quot;constants.h&quot;
#include &quot;dot.h&quot;
#include &quot;error.h&quot;
#include &quot;files.h&quot;
#include &quot;hook_pos.h&quot;
#include &quot;logging.h&quot;
#include &quot;MCMC.h&quot;
#include &quot;nd.h&quot;
#include &quot;random.h&quot;
#include &quot;sim_tree.h&quot;
#include &quot;test.h&quot;
#include &quot;tip_seqs.h&quot;
#include &quot;tree.h&quot;

#include &lt;boost/regex.hpp&gt; 	

using namespace boost::program_options;

int main(int argc, char** argv) {
    ...
}
</code></pre>
<p>Des Weiteren habe ich ein Header-File standard.h, in dem ich alles habe, was man haeufig braucht (um vorkompilierte Header nutzen zu koennen, binde ich es in fast allen Files als erstes ein). standard.h sieht wie folgt aus (Details sind hier nicht wichtig):</p>
<pre><code class="language-cpp">#ifndef STANDARD_H_
#define STANDARD_H_

#include &lt;fstream&gt;
#include &lt;iostream&gt;
#include &lt;sstream&gt;

#include &lt;iomanip&gt;

#include &lt;list&gt;
#include &lt;map&gt;
#include &lt;set&gt;
#include &lt;string&gt;
#include &lt;vector&gt;

#include &lt;cstdio&gt;
#include &lt;cmath&gt;
#include &lt;ctime&gt;
#include &lt;unistd.h&gt;

#include &lt;gsl/gsl_blas.h&gt;
#include &lt;gsl/gsl_cdf.h&gt;
#include &lt;gsl/gsl_errno.h&gt;
#include &lt;gsl/gsl_integration.h&gt;
#include &lt;gsl/gsl_linalg.h&gt;
#include &lt;gsl/gsl_math.h&gt;
#include &lt;gsl/gsl_matrix.h&gt;
#include &lt;gsl/gsl_min.h&gt;
#include &lt;gsl/gsl_randist.h&gt;
#include &lt;gsl/gsl_roots.h&gt;
#include &lt;gsl/gsl_sf_gamma.h&gt;

#include &lt;boost/algorithm/string.hpp&gt;
#include &lt;boost/assign/list_of.hpp&gt;
#include &lt;boost/assign/std/vector.hpp&gt;
#include &lt;boost/checked_delete.hpp&gt;
#include &lt;boost/filesystem.hpp&gt;
#include &lt;boost/foreach.hpp&gt;
#include &lt;boost/format.hpp&gt;
#include &quot;boost/lexical_cast.hpp&quot;
#include &quot;boost/multi_array.hpp&quot;
#include &lt;boost/operators.hpp&gt;
#include &lt;boost/program_options.hpp&gt;
#include &lt;boost/scoped_ptr.hpp&gt;
#include &lt;boost/shared_ptr.hpp&gt;
#include &lt;boost/tokenizer.hpp&gt;
#include &lt;boost/tuple/tuple.hpp&gt;
#include &lt;boost/utility.hpp&gt;
#include &lt;boost/variant.hpp&gt;
#include &lt;boost/weak_ptr.hpp&gt;

#include &lt;log4cxx/basicconfigurator.h&gt;
#include &lt;log4cxx/helpers/exception.h&gt;
#include &lt;log4cxx/logger.h&gt;
#include &lt;log4cxx/propertyconfigurator.h&gt;

#include &quot;bool.h&quot;
#include &quot;io_contnr.h&quot;
#include &quot;rvec.h&quot;

using namespace boost;
using namespace boost::assign;
using namespace boost::filesystem;
using namespace log4cxx;
using namespace log4cxx::helpers;
using namespace std;

#define FOREACH         BOOST_FOREACH
#define REVERSE_FOREACH BOOST_REVERSE_FOREACH

extern shared_ptr&lt;ofstream&gt; fout;

template &lt;class O, class V&gt; typename V::result_type apply_visitor(V&amp; v, O&amp; o)
{
    o.accept(&amp;v);
    return v.result();
}

template &lt;class O, class V&gt; typename V::result_type apply_visitor(V&amp; v, O* o)
{
    o-&gt;accept(&amp;v);
    return v.result();
}

#endif
</code></pre>
<p>Wenn ich nun</p>
<pre><code class="language-cpp">#include &lt;boost/regex.hpp&gt;
</code></pre>
<p>aus <a href="http://main.cc" rel="nofollow">main.cc</a> nach standard.h verschiebe, erhalte ich die folgende Fehlermeldung. Dabei ist Rev_Nd eine meiner Klassen,</p>
<pre><code class="language-cpp">Base_Nd&lt;Rev_Nd, Rev_NC, Rev_Tree&gt;
</code></pre>
<p>und</p>
<pre><code class="language-cpp">Prob_Nd&lt;Rev_Nd, Rev_NC, Rev_Tree&gt;
</code></pre>
<p>sind Instanzen von Klassentemplates, aus denen Rev_Nd abgeleitet ist.</p>
<pre><code class="language-cpp">**** Build of configuration Debug for project GenRecon ****

make all 
Building file: ../main.cc
Invoking: GCC C++ Compiler
g++ -I../../../libs/boost -I../../../libs/gsl/include -I../../../libs/log4cxx/include -I../ -I../src -I../src/classification -I../src/IO -I../src/node -I../src/tree -O0 -g3 -c -fmessage-length=0 -ansi -MMD -MP -MF&quot;main.d&quot; -MT&quot;main.d&quot; -o&quot;main.o&quot; &quot;../main.cc&quot;
In file included from ../main.cc:10:
/usr/include/c++/4.3/bits/stl_iterator_base_types.h: In instantiation of »std::iterator_traits&lt;Rev_Nd&gt;«:
../../../libs/boost/boost/regex/v4/iterator_traits.hpp:116:   instantiated from »boost::re_detail::regex_iterator_traits&lt;Rev_Nd&gt;«   // ???
../src/node/base_nd.h:27:   instantiated from »Base_Nd&lt;Rev_Nd, Rev_NC, Rev_Tree&gt;«
../src/node/base_nd.h:91:   instantiated from »Prob_Nd&lt;Rev_Nd, Rev_NC, Rev_Tree&gt;«
../src/node/nd.h:26:   instantiated from here
/usr/include/c++/4.3/bits/stl_iterator_base_types.h:133: Fehler: invalid use of incomplete type »class Rev_Nd«
../src/IO/dot.h:8: Fehler: forward declaration of »class Rev_Nd«
/usr/include/c++/4.3/bits/stl_iterator_base_types.h:134: Fehler: invalid use of incomplete type »class Rev_Nd«
../src/IO/dot.h:8: Fehler: forward declaration of »class Rev_Nd«
/usr/include/c++/4.3/bits/stl_iterator_base_types.h:135: Fehler: invalid use of incomplete type »class Rev_Nd«
../src/IO/dot.h:8: Fehler: forward declaration of »class Rev_Nd«
/usr/include/c++/4.3/bits/stl_iterator_base_types.h:136: Fehler: invalid use of incomplete type »class Rev_Nd«
../src/IO/dot.h:8: Fehler: forward declaration of »class Rev_Nd«
/usr/include/c++/4.3/bits/stl_iterator_base_types.h:137: Fehler: invalid use of incomplete type »class Rev_Nd«
../src/IO/dot.h:8: Fehler: forward declaration of »class Rev_Nd«
</code></pre>
<p>Das verstehe ich nun ueberhaupt nicht, denn:</p>
<ul>
<li><a href="http://main.cc" rel="nofollow">main.cc</a> bindet standard.h als erstes ein und <a href="http://main.cc" rel="nofollow">main.cc</a> ist der einzige Ort, wo ich boost::regex brauche</li>
<li>Wie kommt die Zeile</li>
</ul>
<pre><code class="language-cpp">instantiated from »boost::re_detail::regex_iterator_traits&lt;Rev_Nd&gt;«
</code></pre>
<p>zu stande? regex wird von Rev_Nd nicht benutzt und hat damit ueberhaupt nichts zu tun (Rev_Nd ist eine Klasse, die bestimmte Knoten in einen Graphen repraesentiert).</p>
<p>Faellt irgendjemanden hierzu was ein? Insbesondere: Wie gehe ich solche Probleme am besten an? Die mir bekannten Standard-Methoden zum Finden von Komplierfehler helfen mir hier nicht weiter.</p>
<p>Nachtrag: Wenn ich uebrigens</p>
<pre><code class="language-cpp">#include &lt;boost/regex.hpp&gt;
</code></pre>
<p>sowohl in <a href="http://main.cc" rel="nofollow">main.cc</a> als auch standard.h habe, kann ich kompilieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/240781/kompilierfehler-bei-boost-regex</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 20:53:44 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/240781.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 11 May 2009 15:40:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Kompilierfehler bei boost::regex on Mon, 11 May 2009 15:46:18 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe ein laengeres, kompilierfaehiges Programm, bei dem ich boost::regex mittels</p>
<pre><code class="language-cpp">#include &lt;boost/regex.hpp&gt;
</code></pre>
<p>in <a href="http://main.cc" rel="nofollow">main.cc</a> einbinde. Der Anfang von <a href="http://main.cc" rel="nofollow">main.cc</a> sieht wie folgt aus (Details sind hier nicht wichtig):</p>
<pre><code class="language-cpp">#include &quot;standard.h&quot;

#include &quot;constants.h&quot;
#include &quot;dot.h&quot;
#include &quot;error.h&quot;
#include &quot;files.h&quot;
#include &quot;hook_pos.h&quot;
#include &quot;logging.h&quot;
#include &quot;MCMC.h&quot;
#include &quot;nd.h&quot;
#include &quot;random.h&quot;
#include &quot;sim_tree.h&quot;
#include &quot;test.h&quot;
#include &quot;tip_seqs.h&quot;
#include &quot;tree.h&quot;

#include &lt;boost/regex.hpp&gt; 	

using namespace boost::program_options;

int main(int argc, char** argv) {
    ...
}
</code></pre>
<p>Des Weiteren habe ich ein Header-File standard.h, in dem ich alles habe, was man haeufig braucht (um vorkompilierte Header nutzen zu koennen, binde ich es in fast allen Files als erstes ein). standard.h sieht wie folgt aus (Details sind hier nicht wichtig):</p>
<pre><code class="language-cpp">#ifndef STANDARD_H_
#define STANDARD_H_

#include &lt;fstream&gt;
#include &lt;iostream&gt;
#include &lt;sstream&gt;

#include &lt;iomanip&gt;

#include &lt;list&gt;
#include &lt;map&gt;
#include &lt;set&gt;
#include &lt;string&gt;
#include &lt;vector&gt;

#include &lt;cstdio&gt;
#include &lt;cmath&gt;
#include &lt;ctime&gt;
#include &lt;unistd.h&gt;

#include &lt;gsl/gsl_blas.h&gt;
#include &lt;gsl/gsl_cdf.h&gt;
#include &lt;gsl/gsl_errno.h&gt;
#include &lt;gsl/gsl_integration.h&gt;
#include &lt;gsl/gsl_linalg.h&gt;
#include &lt;gsl/gsl_math.h&gt;
#include &lt;gsl/gsl_matrix.h&gt;
#include &lt;gsl/gsl_min.h&gt;
#include &lt;gsl/gsl_randist.h&gt;
#include &lt;gsl/gsl_roots.h&gt;
#include &lt;gsl/gsl_sf_gamma.h&gt;

#include &lt;boost/algorithm/string.hpp&gt;
#include &lt;boost/assign/list_of.hpp&gt;
#include &lt;boost/assign/std/vector.hpp&gt;
#include &lt;boost/checked_delete.hpp&gt;
#include &lt;boost/filesystem.hpp&gt;
#include &lt;boost/foreach.hpp&gt;
#include &lt;boost/format.hpp&gt;
#include &quot;boost/lexical_cast.hpp&quot;
#include &quot;boost/multi_array.hpp&quot;
#include &lt;boost/operators.hpp&gt;
#include &lt;boost/program_options.hpp&gt;
#include &lt;boost/scoped_ptr.hpp&gt;
#include &lt;boost/shared_ptr.hpp&gt;
#include &lt;boost/tokenizer.hpp&gt;
#include &lt;boost/tuple/tuple.hpp&gt;
#include &lt;boost/utility.hpp&gt;
#include &lt;boost/variant.hpp&gt;
#include &lt;boost/weak_ptr.hpp&gt;

#include &lt;log4cxx/basicconfigurator.h&gt;
#include &lt;log4cxx/helpers/exception.h&gt;
#include &lt;log4cxx/logger.h&gt;
#include &lt;log4cxx/propertyconfigurator.h&gt;

#include &quot;bool.h&quot;
#include &quot;io_contnr.h&quot;
#include &quot;rvec.h&quot;

using namespace boost;
using namespace boost::assign;
using namespace boost::filesystem;
using namespace log4cxx;
using namespace log4cxx::helpers;
using namespace std;

#define FOREACH         BOOST_FOREACH
#define REVERSE_FOREACH BOOST_REVERSE_FOREACH

extern shared_ptr&lt;ofstream&gt; fout;

template &lt;class O, class V&gt; typename V::result_type apply_visitor(V&amp; v, O&amp; o)
{
    o.accept(&amp;v);
    return v.result();
}

template &lt;class O, class V&gt; typename V::result_type apply_visitor(V&amp; v, O* o)
{
    o-&gt;accept(&amp;v);
    return v.result();
}

#endif
</code></pre>
<p>Wenn ich nun</p>
<pre><code class="language-cpp">#include &lt;boost/regex.hpp&gt;
</code></pre>
<p>aus <a href="http://main.cc" rel="nofollow">main.cc</a> nach standard.h verschiebe, erhalte ich die folgende Fehlermeldung. Dabei ist Rev_Nd eine meiner Klassen,</p>
<pre><code class="language-cpp">Base_Nd&lt;Rev_Nd, Rev_NC, Rev_Tree&gt;
</code></pre>
<p>und</p>
<pre><code class="language-cpp">Prob_Nd&lt;Rev_Nd, Rev_NC, Rev_Tree&gt;
</code></pre>
<p>sind Instanzen von Klassentemplates, aus denen Rev_Nd abgeleitet ist.</p>
<pre><code class="language-cpp">**** Build of configuration Debug for project GenRecon ****

make all 
Building file: ../main.cc
Invoking: GCC C++ Compiler
g++ -I../../../libs/boost -I../../../libs/gsl/include -I../../../libs/log4cxx/include -I../ -I../src -I../src/classification -I../src/IO -I../src/node -I../src/tree -O0 -g3 -c -fmessage-length=0 -ansi -MMD -MP -MF&quot;main.d&quot; -MT&quot;main.d&quot; -o&quot;main.o&quot; &quot;../main.cc&quot;
In file included from ../main.cc:10:
/usr/include/c++/4.3/bits/stl_iterator_base_types.h: In instantiation of »std::iterator_traits&lt;Rev_Nd&gt;«:
../../../libs/boost/boost/regex/v4/iterator_traits.hpp:116:   instantiated from »boost::re_detail::regex_iterator_traits&lt;Rev_Nd&gt;«   // ???
../src/node/base_nd.h:27:   instantiated from »Base_Nd&lt;Rev_Nd, Rev_NC, Rev_Tree&gt;«
../src/node/base_nd.h:91:   instantiated from »Prob_Nd&lt;Rev_Nd, Rev_NC, Rev_Tree&gt;«
../src/node/nd.h:26:   instantiated from here
/usr/include/c++/4.3/bits/stl_iterator_base_types.h:133: Fehler: invalid use of incomplete type »class Rev_Nd«
../src/IO/dot.h:8: Fehler: forward declaration of »class Rev_Nd«
/usr/include/c++/4.3/bits/stl_iterator_base_types.h:134: Fehler: invalid use of incomplete type »class Rev_Nd«
../src/IO/dot.h:8: Fehler: forward declaration of »class Rev_Nd«
/usr/include/c++/4.3/bits/stl_iterator_base_types.h:135: Fehler: invalid use of incomplete type »class Rev_Nd«
../src/IO/dot.h:8: Fehler: forward declaration of »class Rev_Nd«
/usr/include/c++/4.3/bits/stl_iterator_base_types.h:136: Fehler: invalid use of incomplete type »class Rev_Nd«
../src/IO/dot.h:8: Fehler: forward declaration of »class Rev_Nd«
/usr/include/c++/4.3/bits/stl_iterator_base_types.h:137: Fehler: invalid use of incomplete type »class Rev_Nd«
../src/IO/dot.h:8: Fehler: forward declaration of »class Rev_Nd«
</code></pre>
<p>Das verstehe ich nun ueberhaupt nicht, denn:</p>
<ul>
<li><a href="http://main.cc" rel="nofollow">main.cc</a> bindet standard.h als erstes ein und <a href="http://main.cc" rel="nofollow">main.cc</a> ist der einzige Ort, wo ich boost::regex brauche</li>
<li>Wie kommt die Zeile</li>
</ul>
<pre><code class="language-cpp">instantiated from »boost::re_detail::regex_iterator_traits&lt;Rev_Nd&gt;«
</code></pre>
<p>zu stande? regex wird von Rev_Nd nicht benutzt und hat damit ueberhaupt nichts zu tun (Rev_Nd ist eine Klasse, die bestimmte Knoten in einen Graphen repraesentiert).</p>
<p>Faellt irgendjemanden hierzu was ein? Insbesondere: Wie gehe ich solche Probleme am besten an? Die mir bekannten Standard-Methoden zum Finden von Komplierfehler helfen mir hier nicht weiter.</p>
<p>Nachtrag: Wenn ich uebrigens</p>
<pre><code class="language-cpp">#include &lt;boost/regex.hpp&gt;
</code></pre>
<p>sowohl in <a href="http://main.cc" rel="nofollow">main.cc</a> als auch standard.h habe, kann ich kompilieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1709072</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1709072</guid><dc:creator><![CDATA[ingobulla]]></dc:creator><pubDate>Mon, 11 May 2009 15:46:18 GMT</pubDate></item></channel></rss>