<?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>compile | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/compile/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>Fri, 26 Jun 2020 12:34:10 +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>compile | 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>That Clang C compilation</title>
		<link>https://learncgames.com/that-clang-c-compilation/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=that-clang-c-compilation</link>
					<comments>https://learncgames.com/that-clang-c-compilation/#comments</comments>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Tue, 10 Mar 2020 00:00:37 +0000</pubDate>
				<category><![CDATA[Clang]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[guard]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=95</guid>

					<description><![CDATA[<p>I spent about five hours trying to get the timing code to compile before I got it compiling and working. Now I&#8217;m used to the concept of include guards in C. Those are the #ifndef that you see like this: #ifndef _timeh #include &#60;linux/time.h&#62; #define _timeh 1 #endif But in the hr_time.c file these include guards [&#8230;]</p>
The post <a href="https://learncgames.com/that-clang-c-compilation/">That Clang C compilation</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;:14,&quot;href&quot;:&quot;https:\/\/github.com\/David-H-Bolton\/LearnCOnLinux&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20250213114627\/https:\/\/github.com\/David-H-Bolton\/LearnCOnLinux&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 10:35:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-09 16:40:14&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 18:24:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-15 22:16:31&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-18 22:19:30&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-21 22:22:05&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-25 04:17:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-28 04:17:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-03 04:22:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-06 04:38:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-09 08:48:04&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-12 09:17:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-15 10:18:26&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-18 12:43:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-21 15:14:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-24 15:19:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-27 16:38:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-30 19:05:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-02 19:29:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-05 21:51:33&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-08 22:18:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-11 22:18:38&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-14 22:20:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-18 07:27:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-21 10:16:46&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-21 10:16:46&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'></div>
<p>I spent about five hours trying to get the timing code to compile before I got it compiling and working. Now I&#8217;m used to the concept of include guards in C. Those are the #ifndef that you see like this:</p>
<pre><code class="language-c" data-line="">#ifndef _timeh
  #include &lt;linux/time.h&gt;
  #define _timeh 1
#endif</code></pre>
<p>But in the <strong>hr_time.c </strong>file these include guards are on steroids. Not only did I need to include <strong>&lt;time.h&gt;</strong>, I also had to include <strong>&lt;linux/time.h&gt;</strong> but with a couple of extra #defines in there. It doesn&#8217;t seem right and wasn&#8217;t needed with the Windows version.  I&#8217;d welcome any comments on this.</p>
<pre><code class="language-c" data-line="">#ifndef _timeh
  #include &lt;linux/time.h&gt;
  #define __timespec_defined 1 
  #define __itimerspec_defined 1
  #include &lt;time.h&gt;
  #define _timeh 1
#endif</code></pre>
<p><img fetchpriority="high" decoding="async" class="size-medium wp-image-98 alignleft" src="https://learncgames.com/wp-content/uploads/2020/03/sdldemo2-300x232.png" alt="The sdldemo program with timing whown in the window caption." width="300" height="232" srcset="https://learncgames.com/wp-content/uploads/2020/03/sdldemo2-300x232.png 300w, https://learncgames.com/wp-content/uploads/2020/03/sdldemo2.png 760w" sizes="(max-width: 300px) 100vw, 300px" />Without these, I&#8217;d get compile errors like <em>__timespec redefined</em> errors.</p>
<pre><code class="language-c" data-line=""></code></pre>
<p>I&#8217;ve uploaded the source files and Visual Studio Code JSON files for this in the file asteroids_ch25.zip in the new repository for the <a href="https://github.com/David-H-Bolton/LearnCOnLinux" target="_blank" rel="noopener noreferrer">Learn C on Linux Ebook</a></p>
<pre><code class="language-c" data-line=""></code></pre>
<p>So feel free to try it. The only difference between this and the version shown in an earlier post is the time (in the window caption) to draw all 100,000 rectangles,  You&#8217;ll need to install SDL2 if you want to compile and run the program.</p>The post <a href="https://learncgames.com/that-clang-c-compilation/">That Clang C compilation</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://learncgames.com/that-clang-c-compilation/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">95</post-id>	</item>
	</channel>
</rss>
