0

I am new to C++ and when trying to educate myself on header files and how to use them, I keep getting this error that I'm having trouble understanding:

main.obj : error LNK2019: unresolved external symbol "void __cdecl Add(int,int)" (?Add@@YAXHH@Z) referenced in function _main

All I'm doing is just trying to use a function from a seperate header file. I believe I have declared and defined it correctly.

Here is the code,

main.cpp:

#include <iostream>

void Add(int, int);

int main() 
{
    Add(1, 2);
    std::cin.get();
}

math.h:

#include<iostream>

void Add(int a, int b) 
{
    std::cout << a + b << std::endl;
}

All help appreciated!

sha1
  • 19
  • 1
  • 6

0 Answers0