I am trying to run my C++ program on my mac and i have tried both VS Code and Clion and unfortunately on both occasions, i got the same error code below.
All i am trying to do is get the method from the other file and use it in my main file when compiled.
Main code file
#include "pch.h"
#include "GUI.h"
using namespace std;
int main()
{
GUI gui;
gui.logoScreen();
}
GUI file
#include "pch.h"
#include "GUI.h"
using namespace std;
void GUI::logoScreen() {
cout << "@@@@@@@ @@@@@@ @@@@@@@ @@@@@@@ @@@@@@@@" << endl;
cout << "@@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@@" << endl;
cout << "!@@ @@! @@@ @@! @@@ @@! @@@ !@@" << endl;
cout << "!@! !@! @!@ !@! @!@ !@! @!@ !@!" << endl;
cout << "!@! @!@!@!@! @!@!!@! @!@ !@! @!@!@!@!@ !@! @!@!@" << endl;
cout << "!!! !!!@!!!! !!@!@! !@! !!! !!!@!@!!! !!! !!@!!" << endl;
cout << ":!! !!: !!! !!: :!! !!: !!! :!! !!:" << endl;
cout << ":!: :!: !:! :!: !:! :!: !:! :!: !::" << endl;
cout << "::: ::: :: ::: :: ::: :::: :: ::: ::::" << endl;
cout << ":: :: : : : : : : : :: : : :: :: :" << endl;
}
Error code:
Undefined symbols for architecture x86_64:
"GUI::logoScreen()", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)