user38721: I wonder why the following minimal example sketch doesn't compile (unknown type name 'uint16_t'):
sketch_does_not_compile.ino:
#include "myheader.h"

void setup() {
  char a[]="hello world";
  uint16_t l=str_len(a);
  Serial.println(l);
}

void loop() {}

myheader.c:
uint16_t str_len(char* input_string) {
  uint16_t i=0;
  while (input_string[i++]!='\0');
  return i;
}

myheader.h:
#include "myheader.h"

uint16_t str_len(char* input_string);

Compilation fails with:
myheader.c: At top level:
myheader.c:3:1: error: unknown type name 'uint16_t'
 uint16_t str_len(char* input_string);
 ^
exit status 1
unknown type name 'uint16_t'

Using uint16_t in the .ino-file directly like in the sketch below compiles fine.
sketch_compiles.ino:
uint16_t str_len(char* input_string) {
  uint16_t i=0;
  while (input_string[i++]!='\0');
  return i;
}

void setup() {
  char a[]="hello world";
  uint16_t l=str_len(a);
  Serial.println(l);
}

void loop() {}

What am I missing?

user61722: Using #include <Arduino.h> in your myheader.h will also include <stdint.h> and probably solve this.
The Arduino IDE automatically includes Arduino.h in the sketch itself, but apparently not for external stuff.

38721: <p>I wonder why the following minimal example sketch doesn't compile (<code>unknown type name 'uint16_t'</code>):</p>
<p><code>sketch_does_not_compile.ino</code>:</p>
<pre><code>#include &quot;myheader.h&quot;

void setup() {
  char a[]=&quot;hello world&quot;;
  uint16_t l=str_len(a);
  Serial.println(l);
}

void loop() {}
</code></pre>
<p><code>myheader.c</code>:</p>
<pre><code>uint16_t str_len(char* input_string) {
  uint16_t i=0;
  while (input_string[i++]!='\0');
  return i;
}
</code></pre>
<p><code>myheader.h</code>:</p>
<pre><code>#include &quot;myheader.h&quot;

uint16_t str_len(char* input_string);
</code></pre>
<p>Compilation fails with:</p>
<pre><code>myheader.c: At top level:
myheader.c:3:1: error: unknown type name 'uint16_t'
 uint16_t str_len(char* input_string);
 ^
exit status 1
unknown type name 'uint16_t'
</code></pre>
<p>Using <code>uint16_t</code> in the .ino-file directly like in the sketch below compiles fine.</p>
<p><code>sketch_compiles.ino</code>:</p>
<pre><code>uint16_t str_len(char* input_string) {
  uint16_t i=0;
  while (input_string[i++]!='\0');
  return i;
}

void setup() {
  char a[]=&quot;hello world&quot;;
  uint16_t l=str_len(a);
  Serial.println(l);
}

void loop() {}
</code></pre>
<p>What am I missing?</p>
 61722: <p>Using <code>#include &lt;Arduino.h&gt;</code> in your myheader.h will also include <code>&lt;stdint.h&gt;</code> and probably solve this.</p>
<p>The Arduino IDE automatically includes Arduino.h in the sketch itself, but apparently not for external stuff.</p>
