Learning C++ and trying to create a header file to add two intergers.
add.h header file looks like this:
#ifndef ADD_H_INCLUDED
#define ADD_H_INCLUDED
int add(int x, int y);
#endif
main.cpp source file looks like this:
#include <iostream>
#include "add.h"
int main()
{
using namespace std;
cout << "The sum of 3 and 4 is " << add(3, 4) << endl;
return 0;
}
Keep getting error: "In function 'main' undefined reference to 'add(int, int)'. I think my code is OK. Has anyone had trouble with this too? Thank you for your help!!