<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kim Kulling</title>
    <description>The latest articles on DEV Community by Kim Kulling (@kimkulling).</description>
    <link>https://dev.to/kimkulling</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1623%2Ffaf5ab09-f9ff-4804-8ba8-3e30565b9eb5.png</url>
      <title>DEV Community: Kim Kulling</title>
      <link>https://dev.to/kimkulling</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kimkulling"/>
    <language>en</language>
    <item>
      <title>Fighting with json - a war story</title>
      <dc:creator>Kim Kulling</dc:creator>
      <pubDate>Thu, 05 Feb 2026 15:01:03 +0000</pubDate>
      <link>https://dev.to/kimkulling/fighting-with-json-a-war-story-41dn</link>
      <guid>https://dev.to/kimkulling/fighting-with-json-a-war-story-41dn</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;I was refactoring the build environment for an internal C++ project at work. To keep things simple, we used the following JSON library:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/nlohmann/json" rel="noopener noreferrer"&gt;https://github.com/nlohmann/json&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The build system was based on CMake. I planned to replace our wrapper scripts for CMake with a preset.json. If you haven’t heard of this feature yet: when you want to set specific configurations for customers via CMake defines, you can predefine these in a dedicated preset file. It works surprisingly well. For my experimental render engine, I put all the Windows packages installation via vcpkg into a preset file like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "version": 3,
    "configurePresets": [
        {
            "name": "default",
            "binaryDir": "${sourceDir}",
            "cacheVariables": {
                "CMAKE_TOOLCHAIN_FILE": "contrib/vcpkg/scripts/buildsystems/vcpkg.cmake"
            }
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You now invoke the build with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cmake .\CMakeLists.txt --preset=default
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;under Windows, and the user no longer needs to worry about installing vcpkg, since it’s shipped under contrib.&lt;/p&gt;

&lt;p&gt;I applied the same logic for compiler- and target-specific settings in the company project. And suddenly, the build failed. The error message read:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error parsing version, missing ;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file mentioned in the errorversion simply contained the current version string and wasn't even used in the C++ build process at all — until now. So what happened?&lt;/p&gt;

&lt;h2&gt;
  
  
  What happened?
&lt;/h2&gt;

&lt;p&gt;After some fruitless searching through the source code, trying to find out whether the version file had accidentally been included somewhere, I confirmed that this wasn’t the case. Otherwise, this build error would have appeared much earlier.&lt;/p&gt;

&lt;p&gt;Next, I searched the CMake build environment to see if there was a pre-processing step that might be turning the version file into a mis-configured header file. Another dead end.&lt;/p&gt;

&lt;p&gt;So what now? I identified the .cpp file that triggered the error. Unfortunately, the MSVC build output didn’t show which include caused the build to fail. So I used the following compiler switch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/showIncludes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this switch enabled, all included files for the translation unit are shown. While digging through the generated output — which listed hundreds of includes — I noticed one header that seemed to be triggering the build error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;json/include/nlohmann/detail/macro_scope.hpp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So I started studying this header more closely. And bingo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#ifdef __has_include
    #if __has_include(&amp;lt;version&amp;gt;)
        #include &amp;lt;version&amp;gt;
    #endif
#endif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the preprocessor supports the &lt;strong&gt;__has_include&lt;/strong&gt; feature, it checks whether a file named version exists. If it does, it gets included implicitly.&lt;br&gt;
Why didn’t this happen in the old build setup I asked myself?&lt;/p&gt;

&lt;p&gt;The answer is simple: in the new preset-based build, the build directory was set to the root directory of the project.&lt;br&gt;
In the old build, we used a directory structure like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;build/&amp;lt;platform&amp;gt;/&amp;lt;config&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So I changed my CMake output directory to build. But that wasn't enough. It had to be at least build/ — in other words, at least two directory levels deep to avoid the problem. That workaround fixed the issue.&lt;/p&gt;

&lt;h2&gt;
  
  
  What have I learned
&lt;/h2&gt;

&lt;p&gt;If build errors don’t make sense, enable all compiler options to extract more info from the build process. Without the option: /showIncludes I would never have found the root cause.&lt;br&gt;
If even then the result seems illogical: accept that it’s still happening. If reality doesn’t match your expectations, change your perspective.&lt;br&gt;
If I didn’t include the file, someone else must have. If it didn’t happen explicitly, it happened implicitly — in this case, via nlohmann.&lt;br&gt;
Just because you don’t know a preprocessor directive to include headers doesn’t mean it doesn’t exist.&lt;br&gt;
Visual Studio knows the __has_include feature — I didn’t.&lt;br&gt;
Never make your build depend on the target directory structure.&lt;br&gt;
I hate these kinds of bugs.&lt;/p&gt;

&lt;p&gt;Thanks a lot for reading!&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>legacycode</category>
      <category>programming</category>
      <category>compiler</category>
    </item>
    <item>
      <title>Assimp: Experimental Rust bindings</title>
      <dc:creator>Kim Kulling</dc:creator>
      <pubDate>Wed, 04 Feb 2026 13:29:02 +0000</pubDate>
      <link>https://dev.to/kimkulling/assimp-experimental-rust-bindings-4k5f</link>
      <guid>https://dev.to/kimkulling/assimp-experimental-rust-bindings-4k5f</guid>
      <description>&lt;p&gt;The Asset-Importer-Lib offers deprecated rust bindings for quite a while. But the implementation was problematic from a maintenancer point of view. Instead of exporting the existing unsafe structs there was a code duplication done for the bindings. &lt;/p&gt;

&lt;p&gt;This PR will use the crate bindgen to provide the unsafe c-bindings from the library. If you want to help and contribute you can take a look onto the following PR: &lt;a href="https://github.com/assimp/assimp/pull/6467" rel="noopener noreferrer"&gt;Rust-Binding proposal&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>opensource</category>
      <category>rust</category>
      <category>showdev</category>
    </item>
    <item>
      <title>"Use System.Diagnostics.Trace and DbgView within a WPF-Application"</title>
      <dc:creator>Kim Kulling</dc:creator>
      <pubDate>Fri, 25 Aug 2017 09:29:15 +0000</pubDate>
      <link>https://dev.to/kimkulling/use-systemdiagnosticstrace-and-dbgview-within-a-wpf-application</link>
      <guid>https://dev.to/kimkulling/use-systemdiagnosticstrace-and-dbgview-within-a-wpf-application</guid>
      <description>&lt;p&gt;&lt;a href="http://kimkulling.de/2017/03/14/c-use-system-diagnostics-trace-and-dbgview-within-a-wpf-application/" rel="noopener noreferrer"&gt;This blogpost was first posted here&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  TRACE using C/C++ with Win32-API
&lt;/h1&gt;

&lt;p&gt;One of my favorite tools to debug Win32/MFC-Applications with UI was the Win32-call:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;OutputDebugString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s"&gt;"Test\n"&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use it to trace debug information withing your application during runtime. Special if you have to analyze some runtime-specific error and you do not have any kind of console / log to do printf-debugging this Win32-Call case save your ass. You only have to run the tool DbgView to monitor these log-entries ( if you want to try it out you can download DbgView &lt;a href="https://docs.microsoft.com/en-us/sysinternals/downloads/debugview" rel="noopener noreferrer"&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;h1&gt;
  
  
  TRACE using C# with WPF
&lt;/h1&gt;

&lt;p&gt;Because I am currently working with C# in my job I wanted to use this tool as well for WVF-applications. And of course there is a corresponding API-method in the .NET-framework called:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;Trace&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can find the documentation &lt;a href="https://msdn.microsoft.com/de-de/library/system.diagnostics.trace.writeline(v=vs.110).aspx" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It is easy to use. Just insert your Trace-log-entries in your code. When you want to take a look into your application you can start DbgView to see, what is ongoing. Just make sure, that you have defined:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#define TRACE
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;at the beginning of your source-file. Here is a small example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#define TRACE
&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System.Diagnosics&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Test&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Trace&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, world!"&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nf"&gt;Exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check if this works fine just run DbgView and run your application. You should be able to see your post &lt;strong&gt;Hello, world!&lt;/strong&gt; there.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>debugging</category>
      <category>programing</category>
      <category>coding</category>
    </item>
  </channel>
</rss>
