<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SDL3 on Linux | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/sdl3-on-linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Mon, 26 May 2025 15:50:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>SDL3 on Linux | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>Setting up SDL3 on Linux</title>
		<link>https://learncgames.com/setting-up-sdl3-on-linux/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=setting-up-sdl3-on-linux</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Mon, 26 May 2025 15:02:41 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[raspberry-pi]]></category>
		<category><![CDATA[SDL]]></category>
		<category><![CDATA[Techniques]]></category>
		<category><![CDATA[SDL3 on Linux]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=3420</guid>

					<description><![CDATA[<p>I knew it wasn&#8217;t going to be easy, but it turned out to be quite a bit more difficult than I thought. The problem is, unlike SDL2, there are no dev versions of SDL3 etc. yet, so you have to build it from scratch. I&#8217;ll be honest, I&#8217;m not sure I could have done it [&#8230;]</p>
The post <a href="https://learncgames.com/setting-up-sdl3-on-linux/">Setting up SDL3 on Linux</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:17,&quot;href&quot;:&quot;https:\/\/github.com\/Ravbug\/sdl3-sample&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260112022859\/https:\/\/github.com\/Ravbug\/sdl3-sample&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 10:35:54&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-09 18:04:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 22:36:31&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-15 23:18:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-19 00:34:59&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-22 04:11:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-25 10:07:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-28 10:09:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-03 12:37:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-06 17:22:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-09 18:51:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-12 20:26:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-15 21:57:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-19 06:22:42&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-22 08:22:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-25 10:53:16&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-28 10:54:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-31 11:05:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-03 11:05:44&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-06 11:57:00&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-09 12:21:08&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-12 12:50:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-15 13:16:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-18 19:14:35&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-21 20:49:12&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-21 20:49:12&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:18,&quot;href&quot;:&quot;https:\/\/github.com\/Ravbug\/sdl3-sample\/wiki\/Setting-up-your-computer&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20250505154154\/https:\/\/github.com\/Ravbug\/sdl3-sample\/wiki\/Setting-up-your-computer&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 10:35:56&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-09 18:04:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 22:36:31&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-15 23:18:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-19 00:35:04&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-22 04:11:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-25 10:07:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-28 10:09:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-03 12:37:48&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-06 17:22:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-09 18:51:14&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-12 20:26:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-15 21:57:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-19 06:22:43&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-22 08:22:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-25 10:53:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-28 10:54:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-31 11:05:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-03 15:25:51&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-06 15:37:45&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-09 19:09:51&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-12 20:24:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-15 20:58:34&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-19 01:38:24&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-19 01:38:24&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'></div>
<p><img fetchpriority="high" decoding="async" class="alignleft size-full wp-image-3421" src="https://learncgames.com/wp-content/uploads/2025/05/sdl3-1.png" alt="SDL3 program running on Raspberry Pi." width="550" height="514" srcset="https://learncgames.com/wp-content/uploads/2025/05/sdl3-1.png 550w, https://learncgames.com/wp-content/uploads/2025/05/sdl3-1-300x280.png 300w" sizes="(max-width: 550px) 100vw, 550px" /></p>
<p>I knew it wasn&#8217;t going to be easy, but it turned out to be quite a bit more difficult than I thought.</p>
<p>The problem is, unlike SDL2, there are no dev versions of SDL3 etc. yet, so you have to build it from scratch.</p>
<p>I&#8217;ll be honest, I&#8217;m not sure I could have done it without this <a title="Link to Ravbug's Setting up SDL3 sample on GitHub" href="https://github.com/Ravbug/sdl3-sample" target="_blank" rel="noopener">GitHub repository</a>. User <em>Ravbug</em> who is very busy person (<em>752 contributions on GitHub in the last year- I tip my hat to him or her!</em>) who provided that repository.</p>
<p>It sets up SDL3, SDL_image, sdl_mixer and SDL_ttf.</p>
<p>Follow his link to the <a title="Ravbug's instructions" href="https://github.com/Ravbug/sdl3-sample/wiki/Setting-up-your-computer" target="_blank" rel="noopener">Wiki page</a> Scroll down to the bottom for the Linux instructions. I can confirm that it works on Raspberry Pi as well.  You&#8217;ll need to install cmake first with</p>
<pre>sudo apt install cmake</pre>
<p>Then run his cmake to build everything and go for a coffee.<br />
Now go into the build folder under sdl3-sample and do</p>
<pre>make</pre>
<p>That only takes a second or so.</p>
<p>After you&#8217;ve done that you&#8217;ll end up with a load of files including an executable sdl-min that you can run. That&#8217;s what generated the Tiger&#8217;s head &#8211; it plays The Sting film&#8217;s theme (The Entertainer) music as well demonstrating that it&#8217;s using SDL_mixer as well as SDL3 and SDL_ttf (<em>I&#8217;m guessing</em>) and of course SDL_image.</p>
<h3>But that is just the start</h3>
<p>To use SDL3 etc in your C program, you need a bit more configuration than with SDL2. I&#8217;m in uncharted waters here but used an AI- Claude 4 to help me get through and it did.</p>
<p>The problem is you have to tell VS Code where the header files are located, the .so files and also the executable needs to know at runtime.</p>
<p>I set up Ravbug&#8217;s sdl3_sample in my home folder so all paths start <strong>/home/david/sdl3-sample. </strong></p>
<p>This is my tasks.json</p>
<p>&nbsp;</p>
<pre><code class="language-json" data-line="">{
    &quot;version&quot;: &quot;2.0.0&quot;,
    &quot;tasks&quot;: [
        {
            &quot;type&quot;: &quot;shell&quot;,
            &quot;label&quot;: &quot;clang-14.0 build active file&quot;,
            &quot;command&quot;: &quot;/usr/bin/clang-14&quot;,
            &quot;args&quot;: [
                &quot;-I/home/david/sdl3-sample/SDL/include&quot;,
                &quot;-I/home/david/sdl3-sample/SDL_image/include&quot;, 
                &quot;-I/home/david/sdl3-sample/SDL_mixer/include&quot;,
                &quot;-I/home/david/sdl3-sample/SDL_ttf/include&quot;,
                &quot;-g&quot;,
                &quot;${file}&quot;,&quot;${workspaceFolder}/hr_time.c&quot;,
                &quot;-L/home/david/sdl3-sample/build&quot;,	
                &quot;-Wl,-rpath,/home/david/sdl3-sample/build&quot;,				
                &quot;-o&quot;,
                &quot;${fileDirname}/${fileBasenameNoExtension}&quot;,
                &quot;-lSDL3&quot;,
                &quot;-lSDL3_image&quot;, 
                &quot;-lSDL3_ttf&quot;   

            ],
            &quot;options&quot;: {
                &quot;cwd&quot;: &quot;/usr/bin&quot;
            },
            &quot;group&quot;: {
                &quot;kind&quot;: &quot;build&quot;,
                &quot;isDefault&quot;: true
            }
        }
    ]
}</code></pre>
<p>The lines that are SDL3 specific include the -I&#8217;s to provide the include path. -L the path to the .so files and the -rpath line is the path to the runtime files which gets linked into the executable.</p>
<p>If you add these three lines into c_cpp_properties.json then you&#8217;ll also avoid the dreaded red squiggles.</p>
<pre><code class="language-json" data-line="">            &quot;includePath&quot;: [
                &quot;${workspaceFolder}/**&quot;,
                &quot;/home/david/sdl3-sample/SDL/include&quot;,
                &quot;/home/david/sdl3-sample/SDL_image/include&quot;,
                &quot;/home/david/sdl3-sample/SDL_ttf/include&quot;
            ],</code></pre>
<pre><code class="language-json" data-line="">
</code></pre>
<p>And your C&#8217;s #includes need the files prefixed like this :</p>
<pre>#include &lt;SDL3/SDL.h&gt;
#include &lt;SDL3_image/SDL_image.h&gt;
#include &lt;SDL3_ttf/SDL_ttf.h&gt;</pre>
<p>And here it is running on my Pi.</p>
<p><img decoding="async" class="alignleft wp-image-3422 size-large" src="https://learncgames.com/wp-content/uploads/2025/05/missilecommand_pi-1024x780.png" alt="Missile Command running on a Raspberry Pi 5 with SDL3" width="1024" height="780" srcset="https://learncgames.com/wp-content/uploads/2025/05/missilecommand_pi-1024x780.png 1024w, https://learncgames.com/wp-content/uploads/2025/05/missilecommand_pi-300x229.png 300w, https://learncgames.com/wp-content/uploads/2025/05/missilecommand_pi-768x585.png 768w, https://learncgames.com/wp-content/uploads/2025/05/missilecommand_pi.png 1108w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>The post <a href="https://learncgames.com/setting-up-sdl3-on-linux/">Setting up SDL3 on Linux</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3420</post-id>	</item>
	</channel>
</rss>
