0

I get this error message when trying to build my program

Undefined symbols for architecture x86_64: "CustomerData::CustomerData()", referenced from: PreferredCustomer::PreferredCustomer() 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)

How do i fix this error? I am running c++ on xcode.

Colby W
  • 1
  • 2
  • is your CustomerData class defined and included in the project? – john elemans Mar 27 '19 at 16:36
  • Possible duplicate of [Xcode build failure "Undefined symbols for architecture x86\_64"](https://stackoverflow.com/questions/18408531/xcode-build-failure-undefined-symbols-for-architecture-x86-64) – MFisherKDX Mar 27 '19 at 16:37
  • Yes, I have that along with a PersonData class and a PreferredCustomer class. – Colby W Mar 27 '19 at 16:38
  • Error message says "use -v to see invocation" and I agree. Please *do* that and put the result in your question as extra details. – Jesper Juhl Mar 27 '19 at 17:13
  • The linker isn't finding a _definition_ for the constructor `CustomerData::CustomerData()`, but the compiler did find a _delcaration_ for it (otherwise that would be your error). The most likely cause is that you haven't properly added a file to your project that contains definitions for the `CustomerData` class (or, if you have, that class is missing a definition for this particular constructor). – JMAA Mar 27 '19 at 17:16
  • In general, you'd do yourself a huge favour to read up on exactly how you go from source code files to a complete compiled binary with C++. This knowledge is pretty essential for understanding errors like this one. – JMAA Mar 27 '19 at 17:18
  • I had a problem with the default constructors. After fixing that problem it compiled fine. Thanks for the help. – Colby W Mar 28 '19 at 21:09

0 Answers0