0

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)
NathanOliver
  • 171,901
  • 28
  • 288
  • 402
iKreateCode
  • 189
  • 3
  • 13

0 Answers0