How to include my own function source code?
Presently I copy the .h and .cpp files containing general purpose functions into each project directory, and everything compiles and links nicely. However, if I try to #include the .h file when it is placed in a different directory, I get a the following 2 errors:
error LNK2001: unresolved external symbol ......
and
fatal error LNK1120: 1 unresolved externals
This occurs if I #include the absolute path, both with and without quoted backslash, and whether or not I add the path to (all sections of ) the Tools:Options:Directories.
I can't believe that there is not a way to include source files which are in some user-defined common directory.
Re: How to include my own function source code?
It's not enough to #include the header. That only provides enough information for the compiler to verify the functions in the header are being called properly. In order to actually *use* the functions, you must compile the .cpp as well and link it with your code.
Either add the .cpp to your project, or compile it into a static library and link it with your project.
Unresolved external symbol means *exactly* what it says. There's an external symbol (something from the .h file) which the linker can't resolve, because it doesn't have access to the cpp file that defines it.