/* Header.h */
// filename : Testcpp41.h
namespace ProcCom {
void SimpleFunc(void);
}
namespace BestCom {
void SimpleFunc(void);
void PrettyFunc(void);
}
/* Source1.cpp */
// filename : cpp_41_2.cpp
#include <iostream>
#include "Testcpp41.h"
using namespace std;
void BestCom::SimpleFunc(void) {
cout << "BestCom is defined." <<"\n";
PrettyFunc();
ProcCom::SimpleFunc();
}
void BestCom::PrettyFunc()
{
cout << "Pretty !! " << "\n";
}
void ProcCom::SimpleFunc(void) {
cout << "ProcCom is defined" <<"\n";
}
/* Source2.cpp */
// filename : cpp_41_3.cpp
#include "Testcpp41.h"
int main(){
BestCom::SimpleFunc();
return 0;
}
I thought that the first source file need to be compiled.
So I am trying to compile it.
And then, I got the error as below.
I searched the issues about "Undefined symbols for architecture arm64."
But I don't know & figure out what the solution is.
If you already knew, or experienced it before, Please let me know what you already knew.
Error :
jinhojeon@jinui-Macmini cpp % g++ cpp_41_2.cpp -o cpp_41_2
Undefined symbols for architecture arm64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)