<?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[Problem GNU libmatheval in c++]]></title><description><![CDATA[<p>Hallo!</p>
<p>für ein Funktionsparser habe ich im Internet nach einer Bibliothek gesucht, die der eingegebenen mathematischen Funktionen für spezifizierte variable Werte auswerten kann und ich bin auf GNU Libmatheval gestoßen. ihre Funktionen könnte ich für mein Programm in C ohne Probleme verwenden ; und jetzt versuche ich seit 3 tage das Programm in C++ umzuschreiben damit ich die Funktionswerte mit Qt plotten kann hier ist das code :</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cstdio&gt;
#include &lt;cstdlib&gt;
#include &lt;cstring&gt;
#include &lt;cassert&gt;
#include &lt;matheval.h&gt;

#define BUFFER_SIZE 256
#define MAX 20
#define pi 3.1415

using namespace std;

int main( int argc, char *argv[])
{
char buffer[BUFFER_SIZE];
int length;
void *f;
char **names;
int count;
double x[MAX];
int j;
cout &lt;&lt;&quot;f(x_f) = &quot;;
cin.getline(buffer, BUFFER_SIZE);
length = strlen (buffer);
if (length &gt; 0 &amp;&amp; buffer[length - 1] == '\n')
buffer[length - 1] = '\0';

f = evaluator_create (buffer);
assert (f);
evaluator_get_variables (f,&amp;names, &amp;count);
cout &lt;&lt;&quot; &quot; ;
for (j = 0; j &lt; count; j++)
// printf (&quot;%s &quot;, names[j]);
cout &lt;&lt;'\n';

for(j=0;j&lt;=MAX-1;j++){
x[j]=(pi/MAX)*j;
x[j]=evaluator_evaluate_x (f, x[j]);
cout &lt;&lt; x[j];
}
evaluator_destroy (f);
exit (EXIT_SUCCESS);
}
</code></pre>
<p>der Compiler meldet mir díe folgenden Fehler:</p>
<pre><code>evaluator.cpp:(.text+0xa9): undefined reference to `evaluator_create'
evaluator.cpp:(.text+0x103): undefined reference to `evaluator_get_variables'
evaluator.cpp:(.text+0x1a1): undefined reference to `evaluator_evaluate_x'
evaluator.cpp:(.text+0x1e6): undefined reference to `evaluator_destroy'
collect2: ld returned 1 exit status
</code></pre>
<p>hat jemand da eine Idee oder kennt Ihr einer andere Library die so ähnliches unter C++ kann.</p>
<p>Danke Schonmal im Voraus</p>
<p>Gruß<br />
Labin</p>
<p>/edit pumuckl: code-Tags</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/283978/problem-gnu-libmatheval-in-c</link><generator>RSS for Node</generator><lastBuildDate>Sat, 22 Aug 2026 09:21:31 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/283978.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Mar 2011 13:43:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem GNU libmatheval in c++ on Wed, 23 Mar 2011 14:20:15 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>für ein Funktionsparser habe ich im Internet nach einer Bibliothek gesucht, die der eingegebenen mathematischen Funktionen für spezifizierte variable Werte auswerten kann und ich bin auf GNU Libmatheval gestoßen. ihre Funktionen könnte ich für mein Programm in C ohne Probleme verwenden ; und jetzt versuche ich seit 3 tage das Programm in C++ umzuschreiben damit ich die Funktionswerte mit Qt plotten kann hier ist das code :</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cstdio&gt;
#include &lt;cstdlib&gt;
#include &lt;cstring&gt;
#include &lt;cassert&gt;
#include &lt;matheval.h&gt;

#define BUFFER_SIZE 256
#define MAX 20
#define pi 3.1415

using namespace std;

int main( int argc, char *argv[])
{
char buffer[BUFFER_SIZE];
int length;
void *f;
char **names;
int count;
double x[MAX];
int j;
cout &lt;&lt;&quot;f(x_f) = &quot;;
cin.getline(buffer, BUFFER_SIZE);
length = strlen (buffer);
if (length &gt; 0 &amp;&amp; buffer[length - 1] == '\n')
buffer[length - 1] = '\0';

f = evaluator_create (buffer);
assert (f);
evaluator_get_variables (f,&amp;names, &amp;count);
cout &lt;&lt;&quot; &quot; ;
for (j = 0; j &lt; count; j++)
// printf (&quot;%s &quot;, names[j]);
cout &lt;&lt;'\n';

for(j=0;j&lt;=MAX-1;j++){
x[j]=(pi/MAX)*j;
x[j]=evaluator_evaluate_x (f, x[j]);
cout &lt;&lt; x[j];
}
evaluator_destroy (f);
exit (EXIT_SUCCESS);
}
</code></pre>
<p>der Compiler meldet mir díe folgenden Fehler:</p>
<pre><code>evaluator.cpp:(.text+0xa9): undefined reference to `evaluator_create'
evaluator.cpp:(.text+0x103): undefined reference to `evaluator_get_variables'
evaluator.cpp:(.text+0x1a1): undefined reference to `evaluator_evaluate_x'
evaluator.cpp:(.text+0x1e6): undefined reference to `evaluator_destroy'
collect2: ld returned 1 exit status
</code></pre>
<p>hat jemand da eine Idee oder kennt Ihr einer andere Library die so ähnliches unter C++ kann.</p>
<p>Danke Schonmal im Voraus</p>
<p>Gruß<br />
Labin</p>
<p>/edit pumuckl: code-Tags</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2038753</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2038753</guid><dc:creator><![CDATA[labin2011]]></dc:creator><pubDate>Wed, 23 Mar 2011 14:20:15 GMT</pubDate></item><item><title><![CDATA[Reply to Problem GNU libmatheval in c++ on Wed, 23 Mar 2011 13:45:15 GMT]]></title><description><![CDATA[<p>Code-Tags...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2038756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2038756</guid><dc:creator><![CDATA[freaky]]></dc:creator><pubDate>Wed, 23 Mar 2011 13:45:15 GMT</pubDate></item><item><title><![CDATA[Reply to Problem GNU libmatheval in c++ on Wed, 23 Mar 2011 14:23:51 GMT]]></title><description><![CDATA[<p>Zum Einen ist das kein Compilerfehler sondern ein Linkerfehler. In der FAQ gibts mindestens einen Eintrag, was der bedeutet, alternativ gibts auch eine Forensuche.</p>
<p>Zu deinem C-Stil (C++-Stil mag ich es nicht nennen) möge jemand anderes was schreiben, ich hab nicht genug Zeit weil ich in ner halben Stunde zur Bahn muss <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2038791</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2038791</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Wed, 23 Mar 2011 14:23:51 GMT</pubDate></item><item><title><![CDATA[Reply to Problem GNU libmatheval in c++ on Wed, 23 Mar 2011 14:46:41 GMT]]></title><description><![CDATA[<p>Danke sehr pumuckl für Ihre Tipps</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2038810</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2038810</guid><dc:creator><![CDATA[labin2011]]></dc:creator><pubDate>Wed, 23 Mar 2011 14:46:41 GMT</pubDate></item><item><title><![CDATA[Reply to Problem GNU libmatheval in c++ on Wed, 23 Mar 2011 16:04:15 GMT]]></title><description><![CDATA[<p>ich habe es zu dem Code zugefügt aber es funktioniert immer noch nicht :<br />
[/code]<br />
extern &quot;C&quot; {<br />
#include &lt;matheval.h&gt;<br />
}</p>
<p>using namespace std;</p>
<p>extern &quot;C&quot; {<br />
void *evaluator_create (char *string);<br />
void evaluator_destroy (void *evaluator);<br />
void evaluator_get_variables (void *evaluator, char ***names, int *count);<br />
double evaluator_evaluate_x (void *evaluator, double x);</p>
<p>}</p>
<p>int main( int argc, char *argv[])<br />
{<br />
[code]<br />
habe immer die gleiche Linkerfehler ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2038885</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2038885</guid><dc:creator><![CDATA[labin2011]]></dc:creator><pubDate>Wed, 23 Mar 2011 16:04:15 GMT</pubDate></item><item><title><![CDATA[Reply to Problem GNU libmatheval in c++ on Wed, 23 Mar 2011 21:55:18 GMT]]></title><description><![CDATA[<p>3-Sterne Programmierer <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039095</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039095</guid><dc:creator><![CDATA[314159265358979]]></dc:creator><pubDate>Wed, 23 Mar 2011 21:55:18 GMT</pubDate></item><item><title><![CDATA[Reply to Problem GNU libmatheval in c++ on Thu, 24 Mar 2011 08:39:42 GMT]]></title><description><![CDATA[<p>labin2011 schrieb:</p>
<blockquote>
<p>Danke sehr pumuckl für Ihre Tipps</p>
</blockquote>
<p>Bitte - hier im Forum duzen wir uns wie allgemein im Netz. Wenn ich online gesiezt werde komme ich mir immer so angestaubt vor <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Das &quot;extern C&quot; ist hier fehl am Platz. Der Code sollte funktionieren, es muss vermutlich lediglich dem Linker beigebracht werden, dass er die Bibliothek mit zum Programm linken muss, das weiß er nicht automatisch. Je nach Compiler/IDE ist das unterschiedlich zu regeln, eine entsprechende Suche sollte aber schnell zu Ergebnissen führen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039198</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039198</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Thu, 24 Mar 2011 08:39:42 GMT</pubDate></item></channel></rss>