Understanding Undefined Error for Architecture "

Ok, I'm new to C ++, so I'm trying to figure out what information I can get from the error message.

Here is the error message

Undefined symbols for architecture x86_64:
  "PieceClothing :: PieceClothing (int)", referenced from:
      ClothesInventory :: getPieceOfClothing (long) in ClothesInventory.o
      ClothesInventory :: insertIntocloset (std :: basic_string, std :: allocator>) in ClothesInventory.o
  "PieceClothing :: PieceClothing ()", referenced from:
      ClothesInventory :: ClothesInventory () in ClothesInventory.o
      ClothesInventory :: ClothesInventory (std :: basic_string, std :: allocator>) in ClothesInventory.o
      std :: map, std :: allocator>> :: operator [] (long const &) in ClothesInventory.o
ld: symbol (s) not found for architecture x86_64
collect2: ld returned 1 exit status

Here is what I understand:
- There are two errors:
- The one that is associated with getPieceOfClothing and insertIntocloset;
- Others in the constructors, perhaps about the map and / or iterator that I have.

Just to clarify, I don’t attach the code, because the essence of the question is to understand all the information that I can get only from the message.

Thanks for any help.

+3
source share
2 answers

The errors are actually related to the constructors:

PieceClothing::PieceClothing(int)
PieceClothing::PieceClothing()

and they say no characters were found for them. This is usually a sign of either:

  • they were not implemented
  • they are implemented, but the file in which the implementation is implemented is not compiled
  • , , .

, . , :

ClothesInventory::getPieceOfClothing(long)
{
   PieceClothing p;
}

, .

, :

1) , , , . , .

2) . , . .

+5

, PieceClothing::PieceClothing(int) PieceClothing::PieceClothing(), , , , , , .

, , .

0

All Articles