0

I'm getting

Undefined symbols for architecture arm64:
  "isValidFormat(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >)", referenced from:
      _main in main-970001.o
  "readFile(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&)", referenced from:
      _main in main-970001.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

when trying to build my code.

isValidFormat is

bool isValidFormat(vector<string> fileContent);

and readFile is

vector<string> readFile(ifstream& file);

These functions don't have anything in them yet as I'm testing other stuff first. I'm using an M1 MacBook Air.

  • 2
    Do these functions have an implementation or just a declaration? If they're just a declaration, are you still trying to call them? – vandench Oct 24 '22 at 14:13
  • 1
    _These functions don't have anything in them yet_...that raises some concerns. Minimally, including an implementation like `bool isValidFormat(vector fileContent) { return bool(); }` (or throwing a not-implemented exception) is necessary to get it to link. The declaration alone `bool isValidFormat(vector fileContent);` with no function body is not enough and will give the _Undefined symbols_ error. – Wyck Oct 24 '22 at 14:17

0 Answers0