So my program is suppose to take in a single number and output all numbers starting from 0 up to that given number squared. I believe this is quite an easy problem but I am struggling with it when it includes headers and source files. I am getting an 'undefined reference to 'squaredint...'' error. I do not understand why it is getting this error though, but I do see where it occurs.

Here is the coding for my main, source, and header files.

main

headerCode:#include "squaredintheader.h" #include <conio.h> #include <iostream> using std::cout; using std::endl; using std::cin; int main(){ int num; cout << "Up to what number do you want squared? " << endl; cin >> num; //the whole squared numbers number_info numbers = squaredint(num, numbers); //outputs the number with the squared numbers for(int i = 0; i != numbers.number.size(); i++){ cout << i << " " << numbers.squared[i] << endl; } cout << "Press enter to continue.."; _getch(); return 0; }

sourceCode:#ifndef GUARD_squarednum_h #define GUARD_squarednum_h #include <vector> //squaredintheader.h struct number_info{ std::vector<int> number; std::vector<int> squared; }; number_info squaredint(const int&, number_info&); #endif

Thanks for your help!Code:#include "squartedintheader.h" #include <vector> using std::vector; number_info squaredint(const int& upto, number_info& squaredlist){ //adds the given number and squared number //to the struct of int vectors for(int i = 0; int != upto; i++){ squaredlist.number.push_back(i); squaredlist.squared.push_back(i*i); } }