<?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 error | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/compile-error/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>Sun, 06 Apr 2025 13:29:13 +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 error | 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>Rust on Windows &#8211; problem with sdl2.lib</title>
		<link>https://learncgames.com/rust-on-windows-problem-with-sdl2-lib/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rust-on-windows-problem-with-sdl2-lib</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Sun, 06 Apr 2025 12:59:46 +0000</pubDate>
				<category><![CDATA[bugs]]></category>
		<category><![CDATA[Rust]]></category>
		<category><![CDATA[SDL]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[compile error]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[SDL2]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=3364</guid>

					<description><![CDATA[<p>I&#8217;m currently unable to compile Rust programs that use SDL2 on Windows. No problems on Ubuntu or Raspberry Pi OS, just Windows 11. Although it says cannot open input file SDL2.lib, I think the problem is a parameter passed into Link.exe. The text from the image above is listed below- I&#8217;ve broken it to make [&#8230;]</p>
The post <a href="https://learncgames.com/rust-on-windows-problem-with-sdl2-lib/">Rust on Windows – problem with sdl2.lib</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>I&#8217;m currently unable to compile Rust programs that use SDL2 on Windows. No problems on Ubuntu or Raspberry Pi OS, just Windows 11.<br />
<img fetchpriority="high" decoding="async" class="alignleft size-large wp-image-3365" src="https://learncgames.com/wp-content/uploads/2025/04/compiling_sdl2_on_windows-1024x174.png" alt="Compiling an SDL2 app (in Rust) on Windows" width="1024" height="174" srcset="https://learncgames.com/wp-content/uploads/2025/04/compiling_sdl2_on_windows-1024x174.png 1024w, https://learncgames.com/wp-content/uploads/2025/04/compiling_sdl2_on_windows-300x51.png 300w, https://learncgames.com/wp-content/uploads/2025/04/compiling_sdl2_on_windows-768x130.png 768w, https://learncgames.com/wp-content/uploads/2025/04/compiling_sdl2_on_windows.png 1213w" sizes="(max-width: 1024px) 100vw, 1024px" />Although it says cannot open input file SDL2.lib, I think the problem is a parameter passed into Link.exe.</p>
<p>The text from the image above is listed below- I&#8217;ve broken it to make it readable as it&#8217;s displayed preformatted and unmodified it is all on a single very wide line!</p>
<pre> = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.43.34808\\bin\\HostX64\\x64\\link.exe" 
"/NOLOGO" "C:\\Users\\dhbol\\AppData\\Local\\Temp\\rustcA1PhoK\\symbols.o" "&lt;70 object files omitted&gt;" 
"D:\\development\\rustapps\\choice\\target\\debug\\deps/{libsdl2-f8d94d30d19bed49.rlib,libsdl2_sys-325e30d8e9547ff4.rlib,
libbitflags-d15393d08e2f31fc.rlib,liblazy_static-c28c0e13093a4168.rlib,liblibc-851e0bf801239f69.rlib}.rlib" 
"&lt;sysroot&gt;\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib/{libstd-*,libpanic_unwind-*,libwindows_targets-*,
librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libunwind-*,libcfg_if-*,liballoc-*,
librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "SDL2.lib" "SDL2_image.lib" "SDL2_ttf.lib" 
"legacy_stdio_definitions.lib" "kernel32.lib" "kernel32.lib" "advapi32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" 
"dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:D:\\development\\rustapps\\choice\\target\\debug\\deps\\choice.exe" 
"/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:&lt;sysroot&gt;\\lib\\rustlib\\etc\\intrinsic.natvis" 
"/NATVIS:&lt;sysroot&gt;\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:&lt;sysroot&gt;\\lib\\rustlib\\etc\\libcore.natvis" 
"/NATVIS:&lt;sysroot&gt;\\lib\\rustlib\\etc\\libstd.natvis"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: LINK : fatal error LNK1181: cannot open input file 'SDL2.lib'␍</pre>
<p>But if you try running part of it like the first line<br />
&#8220;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.43.34808\\bin\\HostX64\\x64\\link.exe&#8221;<br />
&#8220;/NOLOGO&#8221; &#8220;C:\\Users\\dhbol\\AppData\\Local\\Temp\\rustcA1PhoK\\symbols.o&#8221;</p>
<p>Well the path to link..exe is correct, but there&#8217;s no  rustcA1PhoK\symbols.o in that temp folder. Any suggestions welcomed&#8230;</p>
<h2>I just solved it.</h2>
<p>I&#8217;ve left this in, in case anyone else has this problem.</p>
<p>You need to add an environment variable LIB with the address of the SDL .lib files including ttf, image and mixer. Make sure they&#8217;re all in this folder:</p>
<p>C:\Users\<strong>dhbol</strong>\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib</p>
<p>The bold part of the path will be different on you PC.</p>
<p>In File Explorer, right-click on <strong>This PC </strong>then click Properties on the popup menu.</p>
<p><img decoding="async" class="alignleft size-full wp-image-3372" src="https://learncgames.com/wp-content/uploads/2025/04/this_pc.png" alt="File Explorer - This PC,." width="170" height="70" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>It&#8217;ll open Settings &#8211; About, and you need to click <strong>Advanced system settings</strong>.</p>
<p><img decoding="async" class="alignleft size-medium wp-image-3374" src="https://learncgames.com/wp-content/uploads/2025/04/settings_about-300x154.png" alt="settings_about" width="300" height="154" srcset="https://learncgames.com/wp-content/uploads/2025/04/settings_about-300x154.png 300w, https://learncgames.com/wp-content/uploads/2025/04/settings_about.png 600w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>This opens System Properties and on that you click <strong>Environment variables</strong>.</p>
<p><img loading="lazy" decoding="async" class="alignleft size-medium wp-image-3375" src="https://learncgames.com/wp-content/uploads/2025/04/System_properties-264x300.png" alt="System properties on Windows" width="264" height="300" srcset="https://learncgames.com/wp-content/uploads/2025/04/System_properties-264x300.png 264w, https://learncgames.com/wp-content/uploads/2025/04/System_properties.png 412w" sizes="auto, (max-width: 264px) 100vw, 264px" /></p>
<p><img loading="lazy" decoding="async" class="alignleft wp-image-3376 size-full" src="https://learncgames.com/wp-content/uploads/2025/04/environment_variables.png" alt="Environment variables popup on Windows" width="646" height="585" srcset="https://learncgames.com/wp-content/uploads/2025/04/environment_variables.png 646w, https://learncgames.com/wp-content/uploads/2025/04/environment_variables-300x272.png 300w" sizes="auto, (max-width: 646px) 100vw, 646px" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Now just click New and add Lib and that path It should look something like mine. Now reopen Visual Studio and your SDL2 Rust app should now build and run.</p>The post <a href="https://learncgames.com/rust-on-windows-problem-with-sdl2-lib/">Rust on Windows – problem with sdl2.lib</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">3364</post-id>	</item>
	</channel>
</rss>
