I have the following class
class Intern
{
public:
Intern();
Intern(Intern& obj);
~Intern();
Form* makeForm(std::string name, std::string target);
typedef std::map<std::string,Form*(Intern::*)(std::string)> map_t;
Form* makeShrub(std::string target);
Form* makeRobot(std::string target);
Form* makePres(std::string target);
const map_t construct_map(void);
const map_t& return_map(void);
};
Form
is another class that I won't include in my question because it is irrelevant here. The member function I am having trouble with is construct_map:
#include "Intern.hpp"
typedef std::map<std::string,Form*(Intern::*)(std::string)> map_t;
const map_t Intern::construct_map(void)
{
map_t m;
m["shrubbery creation"] = &Intern::makeShrub;
m["robotomy request"] = &Intern::makeRobot;
m["presidential pardon"] = &Intern::makePres;
return m;
}
I have used maps before and I have always used pretty much the same code. However, I get the following error:
Undefined symbols for architecture x86_64:
"Intern::makePres(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
Intern::construct_map() in Intern.o
"Intern::makeRobot(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
Intern::construct_map() in Intern.o
"Intern::makeShrub(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
Intern::construct_map() in Intern.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I don't now why am I getting this error. Can someone help me?
Edit I define makeShrub, makeRobot and makePres in the same document as construct_map, just above it