C++ Visual Studio user defined functions

I would like to use some functions that I create directly without copying the function code each time. I have created and used the functions in line. What library (folder) would I use to hold the functions? Are the functions to be compilied into this holding library? Do I #include this library in the header section of my main code?
I hope I answer your question correctly. I think you do it the same way you would in Dev C++. Save your function to a file, then include that file sometime b4 calling your function.

An example:
Your main.cpp
1
2
3
4
5
6
7
8
#include <iostream>
#include "HelloWorld.h"

int main()
{
    helloWorld();
return 0;
}


Your function saved in the file HelloWorld.h
1
2
3
4
void helloWorld()
{
    std::cout << "Hello World";
}


It should be just that simple. You should be able link to a file in another directory by adding the path with the file name.
#include "C:/user/docs/myFile.h"
Topic archived. No new replies allowed.