Functions Library

I am relatively new to c++ and have a background in php programming so I am pretty familiar with the general syntax but less familiar with the code architecture.

In my php code I have a base of functions library which I have built up to do specialized tasks. I would like to emulate this in my c++ code.

I am using the codeblocks IDE. It is not clear to me how I define a functions library and call in functions from a specific file on a global basis. So far, the projects I have created I need to replicate the same code in specific files which then get compiled into a project.

Perhaps this is just the way it is, but I feel I must be missing something.

My question can be summarized as follows; How do I use a common functions library on individual code projects and have it compile into one project from a centralized location.
Use #include tags at the top of your .cpp or .h file.

Use <> for libraries included within the compiler, and "" for self-defined libraries (aka specific classes). I'm not familiar with codeblocks because I use VS2010 so some function and type definitions might be slightly different. But for the most part, the standard libraries you usually see are gonna be the same. ..Maybe.

Ex.

1
2
3
#include<string>, #include<iostream>, #include<vector>

#include"Class C.h", #include"Tools.h", #include"doge.h" 


As for what specific function you want to use within the given library, you're gonna have to do some research on that.

EDIT: I reread your question and I think what you're looking for isn't so much as a coding question as it is a server mapping question. I'm not qualified to answer that, but the way I'm seeing is, do you want to let's say compile file X.cpp, and have that compiled version be sent to a center server/location?
Last edited on
How do I use a common functions library
Create library first.

Then add path to that library to the your compiler include seach path (so #includes would work)

Now you can start to use it in any projects. If your library is not header-only, you will need to either add its cpp files to your project, or (if you prebuilt it) to link against its object file.


You can try to get and install Boost, whicj is very useful and helpful C++ library. This will help you to understand how libraries works.
Thanks for the replies, they both make sense and I think I have got it figured out now.
Topic archived. No new replies allowed.