I would like to create a library so I can just write: #include <functions.h>
and not have to re-write all the functions every time.
1. Can you please help me understand how that works?
2. I saw videos of this on YouTube but I don't understand what they are doing and how to make it work once I've done it.
//
// Header.h
// test
//
// Created by Home on 4/10/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#ifndef test_Header_h
#define test_Header_h
//my header
#include <iostream>
//included library
class me{
private://variables here
int a, b;
public://functions here
int returnA(){return a;}
int returnB(){return b;}
me();
}
me::me(){//contructor;
int a = 10;
int b = 10;
}
#endif
after you create the main.cpp there should be an option to create a file with it. then select header file. remember when including the header you need to do
#include "headername.h"
1. Created a headername.h file and put it in the project folder.
2. Created a headername.cpp file and put in the project folder.
3. The CPP file has #include "headername.h" in it.
What am I missing?
p.s.
This is really driving me crazy, thanks for the help.
1. Created a headername.h file and put it in the project folder.
2. Created a headername.cpp file and put in the project folder.
3. The CPP file has #include "headername.h" in it.
4. Build that project as a static library. You get a *.lib file out.
5. When you want to use that library in another project:
a). #include the header file (which will need to be in your new project directory etc)
b). Tell the linker you want to link against the lib file (give it the name)
c). Tell the linker where to find the lib file (give it the directory)