Look at line 12 in bot.hpp. Then look at line 5. A bit redundant, don't you think?
Also, note how on line 11 you refer to setName as returning a void value, but on line 10 of bot.cpp it returns a string. Those are two different functions as far as the compiler is concerned.
<nolyc> Undefined reference is a linker error.
It's not a compile error. #includes don't help.
You did not define the thing in the error message, you forgot to link the file that defines it, you forgot to link to the library that defines it, or, if it's a static library, you have the wrong order on the linker command line.
Check which one. (Note that some linkers call it an unresolved external)
Also bot *mybot = new bot();
¿where did you "learn" that?
If you want to create an object use bot mybot;
Edit:
> I removed the return MyName from setName function and I'm still getting this error.
Look at the type
<nolyc> Undefined reference is a linker error.
It's not a compile error. #includes don't help.
You did not define the thing in the error message, you forgot to link the file that defines it, you forgot to link to the library that defines it, or, if it's a static library, you have the wrong order on the linker command line.
Check which one. (Note that some linkers call it an unresolved external)
</quote>
Yeah, the problem was that my compiler couldn't find my header file. When I switched over to my Mac and in Xcode, I had no problems (once I corrected the other issues).
<quote>
Also bot *mybot = new bot();
¿where did you "learn" that?
If you want to create an object use bot mybot;
</quote>
This is correct if you want to allocate an object to the Heap.
bot mybot; stack allocates a bot object and is dealloc'd once it goes out of scope (in this case, leaves the main() function).
similiar to objective-C where you can:
objecttype *myobject = [[myobject alloc] init];
Actually, all objects are heap allocated in Objective-C.
Anyway, that's where I "learned" that.
Do yourself a favor and learn the difference between the heap and the stack.
<quote>
Edit:
> I removed the return MyName from setName function and I'm still getting this error.
Look at the type
</quote>
Do yourself a favor and stop leaking resources.
Every `new' must have a corresponding `delete' where the destructor would be invoked and the memory released.
However, `Code that creates an object using new and then deletes it at the end of the same scope is ugly, error-prone, and inefficient.' (BJarne Stroustrup)
Don't simply write your code as you'll do in another language.