I\'m attempting to link my .cpp implementation file with my header file - I get this error message from my mac terminal -
rowlandev:playground rowlandev$ g++ ma
Here's a good read to understand what's going on when you try to create an executable from source code: How does the compilation/linking process work?
What's going on here is that the linker doesn't know where Person::Person()
, which is being called in main()
, is located. Notice how when you called g++, you never gave it the file where you wrote code for Person::Person()
.
The right way to call g++ is:
$ g++ -o main main.cpp person.cpp