'ld: symbol(s) not found for architecture arm64 on xcode in mac m1
I have to implement a permutation in c++ and I get the error in the title after the operator overloading.
The operator overloading code is here:
template<size_t n>
bool operator<(const permutation<n>& perm1 , const permutation<n>& perm2){
for(int i = 0; i < n ; i++){
if(perm1.arr_[i] > perm2.arr_[i])
return false;
else if(perm1.arr_[i]<perm2.arr_[i]){
return true;
}
}
return false;
}
template<size_t n>
bool operator>(const permutation<n>& perm1 , const permutation<n>& perm2){
return(perm1 < perm2);
}
template<size_t n>
bool operator==(const permutation<n>& perm1 , const permutation<n>& perm2){
for(int i = 0; i < n ; i++){
if(perm1.arr_[i] == perm2.arr_[i])
return true;
}
return false;
}
template<size_t n>
bool operator!=(const permutation<n>& perm1 , const permutation<n>& perm2){
return(perm1 == perm2);
}
template<size_t n>
bool operator<=(const permutation<n>& perm1 , const permutation<n>& perm2){
for(int i = 0; i < n ; i++){
if(perm1.arr_[i] >= perm2.arr_[i])
return false;
}
return true;
}
template<size_t n>
bool operator>=(const permutation<n>& perm1 , const permutation<n>& perm2){
for(int i = 0; i < n ; i++){
if(perm1.arr_[i] <= perm2.arr_[i])
return false;
}
return true;
}
I get a buildtime error that says
Undefined symbols for architecture arm64:
"operator<(permutation<5ul> const&, permutation<5ul> const&)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried to use the fix from Undefined symbols for architecture arm64: Xcode 12 but I could not find a setting called "Parallelize Build" on Xcode. I have no clue on how I can fix this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
