Im new to the programming. Recently I've been practicing my coding following by watching Youtube video. I did exactly like the coding in the video, but I got errors. Please help me to fix that. By the way, I'm using Xcode. The guy in the video uses Visual Studio.
void printMyClass(const vector<student>& newMyclass)
{
unsigned int size=newMyclass.size();
for (unsigned int i=0; i<size; i++) {
cout<<"The student name is: "<<newMyclass[i].getName()<<endl;
cout<<"The student grade is: "<<newMyclass[i].getGrade()<<endl;
}
}
And the Error Messages:
Undefined symbols for architecture x86_64:
"printMyclass(std::__1::vector<student, std::__1::allocator<student> > const&)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems like something wrong with the PrintMyClass function. Please Help Me!!!
Please use code tags around your source code. The tags are in the palette to the right.
It looks like you started with a C project rather than a C++ project. It's not linking with the C++ runtime library. It's probably easier to start again, pay special attention to the kind of project to create; it has to be a C++ project.