<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)
> So It should recognize that it has a main func because i have int main() right? What am I doing wrong?
You never say that you want to use main.cpp
$ g++ -std=c++11 main.cpp XMLSerializable.cpp -o program.bin |
If you find it convenient you can separate the compilation and link stages.
Also, you are probable leaking memory