still kinda new to C++ . I'm learning basics from tutorial and getting error I shouldn't be getting. I left @ where the error occurs. It says "First defined here. Error: ld returned 1 exit status". I seem to have the example code correct. At least looks same to me. Can you see something I can't ? Any feedback much appreciated.
1 2 3 4 5 6 7 8 9 10
usingnamespace std;
int add(int x, int y);
int main()
{@
cout << "The sum of 3 and 4 is: " << add(3, 4) << endl;
return 0;
}
and this is my add.cpp:
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
usingnamespace std;
int add(int x, int y) {
return x + y;
}
int main()
{
}
It didn't occur to me that the second main() in add.cpp might be an issue since it's empty and C++ ignores empty objects. At least that's what I thought.