confused by 'String' does not name a type message

I am trying to return a string from a function call. Ease of programming and reading were more pertinent for my application than any memory concerns (apart from leaks). In my cpp files I kept getting the compiler error string does not name a type. I have simplified the code to be one function call. This call works when it is contained within an ino file, but fails to compile when moved to a header file or cpp file.

main sketch file

#include "test.h"

void setup() {
  String bob = getString(); //"bob" ;
  // put your setup code here, to run once:
  Serial.begin( 9600 );
  Serial.println( "bob" );

bool showlight = false;
void loop() 
  // put your main code here, to run repeatedly:
  digitalWrite( LED_BUILTIN, (showlight=!showlight?HIGH:LOW) );

  delay( 1000 );  


#include <string.h>
String getString()
  return "bob";

this code produces the error, but move getString to the main ino file and it all works, why is this happening?

[u]s[/u]tring is not the same as [u]S[/u]tring.

Easiest is to include Arduino.h instead of string.h. Else you can try to include WString.h but it might require other includes.