Unknown type name 'string'

I'm trying to compile my code .cpp but even though I include the libraries I get those errors:

error: unknown type name
'string'
static string* split(string s);

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "../../include/kingsort/KingSort.h"
#include <iostream>
#include <string>
using namespace std;


string* KingSort::split(string s) {
    string* arr = new string[2];
    stringstream X(s);
    unsigned int i = 0;
    while (getline(X,arr[i], ' ')) {
        i++;
    }
    return arr;
}


For instance, the MakeFile is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))

SOURCE_FILES = $(call rwildcard, , *.cpp)
OBJECT_FILES = $(SOURCE_FILES:.cpp=.o)

all: build build/main clean_objects

build:
	mkdir -p build

build/main: $(OBJECT_FILES)
	g++ -g $^ -std=c++11 -o $@

%.o: %.cpp
	g++ -g -std=c++11 -c $^ -o $@

clean_objects: $(OBJECT_FILES)
	rm $^


Why am I getting those errors? Thanks!
Did you include <string> in KingSort.h?
Oh I didn't! Thanks!
Topic archived. No new replies allowed.