Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I keep getting an error Undefined symbols for architecturex86_64 & ld: symbol(s) not found for architecture x86_64 I'm running a simple addition program, I have

I keep getting an error "Undefined symbols for architecturex86_64" & "ld: symbol(s) not found for architecture x86_64"

I'm running a simple addition program, I have 3 files: "add.h","add.cpp", "main.cpp"

This is my header file:

___________________

#pragma once

#include

int add(int x, int y);

___________________

Then my add.cpp file:

___________________

#include

using namespace std;

#include "add.h"

int add(int x, int y)

{

return x + y;

}

int main()

{

return 0;

}

___________________

And my main.cpp file:

___________________

#include

using namespace std;

#include "add.h"

int main()

{

cout << "3 + 4 =" << add(3,4) << endl;

return 0;

}

___________________

I can build my add.cpp successfully but my main.cpp filegives me the following error:

Undefined symbols for architecture x86_64:
"add(int, int)", referenced from:
_main in main-deee09.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to seeinvocation)

Build finished with error(s).

x-------x

I'm running it on Visual Studio on a mac, I did some researchand know that there is something wrong with my IDE, I just have noidea how to fix it.

Thank you!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

What kind of financial pressures can an LBO cause?

Answered: 1 week ago

Question

Formal evaluation criteria that limit managerial discretion

Answered: 1 week ago

Question

Absence of disparate impact

Answered: 1 week ago

Question

Performance appraisal criteria based on job analysis

Answered: 1 week ago