<?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[Musik im C++ - Programm]]></title><description><![CDATA[<p>Hallo.</p>
<p>Ich hab folgendes Problem:</p>
<p>Ich will Musik in meinem C++-Programm irgendwie abspielen können, ohne irgendeinen externen Player benutzen zu müssen, das soll also in meinem Programm passieren. Ich hab schon alle Möglichkeiten gegoogelt, zum Beispiel hab ich das hier probiert:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;mmsystem.h&gt;
//...
#pragma comment( lib, &quot;winmm.lib&quot; )

int main() {
    mciSendString(&quot;open untitled.mp3&quot;, NULL, 0, NULL);
    mciSendString(&quot;play untitled.mp3 wait&quot;, NULL, 0, NULL);
    mciSendString(&quot;close untitled.mp3&quot;, NULL, 0, NULL);
    //...
</code></pre>
<p>Aber ich bekomm da andauernd solche Fehlermeldungen:</p>
<pre><code>Zahlenspiel.cpp||undefined reference to `mciSendStringA@16'|
Zahlenspiel.cpp||undefined reference to `mciSendStringA@16'|
Zahlenspiel.cpp||undefined reference to `mciSendStringA@16'|
||=== Erstellen beendet: 3 Fehler, 0 Warnungen===|
</code></pre>
<p>Ich hab auch schon eine andere Möglichkeit probiert:</p>
<pre><code>PlaySound(&quot;untitled.wav&quot;, NULL,SND_ASYNC &amp;&amp; SND_LOOP);
</code></pre>
<p>Aber da bekomm ich eine ähnliche Fehlermeldung:</p>
<pre><code>Zahlenspiel.cpp||undefined reference to `PlaySoundA@12'|
</code></pre>
<p>Was mach ich falsch? Bei den Leuten, denen bei google damit geholfen worden ist, funktioniert das anscheinend, bei mir nicht. Ich benutz die aktuellste Version von Code::Blocks (10.05) mit dem gnu g++ - Compiler. Und ich hab natürlich immer die richtigen Formate (.wav und .mp3) benutzt.</p>
<p>Danke schonmal!,</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/275546/musik-im-c-programm</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 20:06:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/275546.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 16 Oct 2010 16:47:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Musik im C++ - Programm on Sat, 16 Oct 2010 16:49:36 GMT]]></title><description><![CDATA[<p>Hallo.</p>
<p>Ich hab folgendes Problem:</p>
<p>Ich will Musik in meinem C++-Programm irgendwie abspielen können, ohne irgendeinen externen Player benutzen zu müssen, das soll also in meinem Programm passieren. Ich hab schon alle Möglichkeiten gegoogelt, zum Beispiel hab ich das hier probiert:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;mmsystem.h&gt;
//...
#pragma comment( lib, &quot;winmm.lib&quot; )

int main() {
    mciSendString(&quot;open untitled.mp3&quot;, NULL, 0, NULL);
    mciSendString(&quot;play untitled.mp3 wait&quot;, NULL, 0, NULL);
    mciSendString(&quot;close untitled.mp3&quot;, NULL, 0, NULL);
    //...
</code></pre>
<p>Aber ich bekomm da andauernd solche Fehlermeldungen:</p>
<pre><code>Zahlenspiel.cpp||undefined reference to `mciSendStringA@16'|
Zahlenspiel.cpp||undefined reference to `mciSendStringA@16'|
Zahlenspiel.cpp||undefined reference to `mciSendStringA@16'|
||=== Erstellen beendet: 3 Fehler, 0 Warnungen===|
</code></pre>
<p>Ich hab auch schon eine andere Möglichkeit probiert:</p>
<pre><code>PlaySound(&quot;untitled.wav&quot;, NULL,SND_ASYNC &amp;&amp; SND_LOOP);
</code></pre>
<p>Aber da bekomm ich eine ähnliche Fehlermeldung:</p>
<pre><code>Zahlenspiel.cpp||undefined reference to `PlaySoundA@12'|
</code></pre>
<p>Was mach ich falsch? Bei den Leuten, denen bei google damit geholfen worden ist, funktioniert das anscheinend, bei mir nicht. Ich benutz die aktuellste Version von Code::Blocks (10.05) mit dem gnu g++ - Compiler. Und ich hab natürlich immer die richtigen Formate (.wav und .mp3) benutzt.</p>
<p>Danke schonmal!,</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966475</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966475</guid><dc:creator><![CDATA[Incocnito]]></dc:creator><pubDate>Sat, 16 Oct 2010 16:49:36 GMT</pubDate></item><item><title><![CDATA[Reply to Musik im C++ - Programm on Sat, 16 Oct 2010 17:11:33 GMT]]></title><description><![CDATA[<p>Du musst winmm dazulinken (bei Project/Build options/Linker settings/Link libraries eintragen).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966483</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966483</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Sat, 16 Oct 2010 17:11:33 GMT</pubDate></item><item><title><![CDATA[Reply to Musik im C++ - Programm on Sat, 16 Oct 2010 17:26:26 GMT]]></title><description><![CDATA[<p>Ich hab das da jetzt in das linke Fenster unter &quot;Link Libraries&quot; hinzugefügt: (ich hab einfach die datei gesucht und pfad kopiert)</p>
<pre><code>C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\WinMM.Lib
</code></pre>
<p>Ich bekomm aber immer noch die gleichen Fehlermeldungen..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966491</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966491</guid><dc:creator><![CDATA[Incocnito]]></dc:creator><pubDate>Sat, 16 Oct 2010 17:26:26 GMT</pubDate></item><item><title><![CDATA[Reply to Musik im C++ - Programm on Sat, 16 Oct 2010 17:49:55 GMT]]></title><description><![CDATA[<p>Das ist die falsche Datei und für g++ auch das falsche Dateiformat.<br />
Einfach nur winmm eintragen, nichts mit Pfaden oder sonstigen Scherzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966497</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966497</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Sat, 16 Oct 2010 17:49:55 GMT</pubDate></item><item><title><![CDATA[Reply to Musik im C++ - Programm on Sat, 16 Oct 2010 17:51:28 GMT]]></title><description><![CDATA[<p>Hinzufügen der Lib als Abhängigkeit zu Deinem Projekt ist das eine, dem Linker bekanntgeben das er diese auch verwenden soll das andere.</p>
<p>Btw: Kein ISO-C++ Problem sondern fehlerhaftes Handling Deines Linkers, maximal gehört es in die Kategorie WinAPI, sonst ins Compiler-IDE-Forum <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>Gut Schuß<br />
VuuRWerK <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/1966498</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966498</guid><dc:creator><![CDATA[VuuRWerK]]></dc:creator><pubDate>Sat, 16 Oct 2010 17:51:28 GMT</pubDate></item><item><title><![CDATA[Reply to Musik im C++ - Programm on Sat, 16 Oct 2010 17:53:42 GMT]]></title><description><![CDATA[<p>Ok danke, jetzt geht's.<br />
Aber wie verpack ich das jetzt in nen parallelen Thread damit ich abspielen und gleichzeitig spielen kann? Kannst du mir da mal ne Codevorgabe geben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966499</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966499</guid><dc:creator><![CDATA[Incocnito]]></dc:creator><pubDate>Sat, 16 Oct 2010 17:53:42 GMT</pubDate></item><item><title><![CDATA[Reply to Musik im C++ - Programm on Sat, 16 Oct 2010 18:27:00 GMT]]></title><description><![CDATA[<p>An deiner Stelle würde ich mir einmal das DirectX - SDK herunterladen. Hier findest du sehr viele Beispiele, wie du per Direct Show Musikdateien laden und sie (automatisch) in einem seperaten Thread abspielen lassen kannst. Funktionen wie MCI... verblassen gegenüber der Funktionalität von Direct Show.<br />
Und schwer ist die Initialisierung wirklich nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966510</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966510</guid><dc:creator><![CDATA[Vicious Falcon]]></dc:creator><pubDate>Sat, 16 Oct 2010 18:27:00 GMT</pubDate></item><item><title><![CDATA[Reply to Musik im C++ - Programm on Mon, 18 Oct 2010 19:11:57 GMT]]></title><description><![CDATA[<p>Habs auch so geschafft^^<br />
Nachdem ich die lib dazugelinkt hab, funktionierten beide Varianten. mciSendString(); erstellt aber keinen Thread für sich. PlaySound aber schon. Also kann ich prima PlaySound benutzen, und das verpackt sich ganz automatisch in einen eigenen Thread^^</p>
<p>ALso danke für die Hilfe,</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1967268</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967268</guid><dc:creator><![CDATA[Incocnito]]></dc:creator><pubDate>Mon, 18 Oct 2010 19:11:57 GMT</pubDate></item><item><title><![CDATA[Reply to Musik im C++ - Programm on Mon, 18 Oct 2010 21:08:48 GMT]]></title><description><![CDATA[<p>Möchte noch anmerken dass ich hier wirklich eine externe lib wie zB. Irrklang empfehlen würde.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1967336</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967336</guid><dc:creator><![CDATA[cooky451]]></dc:creator><pubDate>Mon, 18 Oct 2010 21:08:48 GMT</pubDate></item></channel></rss>