Xcode: Unusual Compiling Problem

I cannot figure out why Xcode won't compile my code. It doesn't signify any normal syntax errors in main.cpp, but on the sidebar it displays what appears to be a different kind of error.


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


Can anyone tell me what is going on here?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  #include <iostream>
using namespace std;
void chopin(int x, int y, int z, int q);
int main()
{
    int a, b, c, d;
    a = 45;
    b = 7;
    c = 12;
    d = 90;
    chopin(a, b, c, d);
    cout << a << " " << b << " " << c << " " << d << endl;
    return 0;
}

void chopin(int x, int& y, int z, int& q)
{
    cout << x << " " << y << " " << z << " " << q << endl;
    x = 5;
    y = 6;
    z = 7;
    q = 8;
    cout << x << " " << y << " " << z << " " << q << endl;
}
On line 3 try void chopin(int x, int& y, int z, int& q)
Or modify line 16. Nothing to do with Xcode
Last edited on
Topic archived. No new replies allowed.