Whats the difference between making a library and just a .h?

If you make a myscripts.h/myscripts.cpp what's the difference between that and a 'proper' library?

How can you turn it into a library?

Thanks!
1) You can compile .cpp file and distribute .o file with header. That is called static library

2) You can make dinamic or shared library. Google to know how.
If myscripts.h has all of the definitions and declarations, you don't need a library.

If myscripts.h/myscripts.cpp are together then you need to make some decisions. Specifically, are these files specific to a project? If it is simply another object in your project, then you don't need to turn it into a library, just use the standard compiler/linker implementation.

If myscripts.h/myscripts.cpp are going to be used in many projects, then you'll want to turn it into a library. This means that instead of making a .exe when you compile, we are making a .dll for a dynamic library or a .lib for a static library (windows only). A DLL is a dynamic library which means that you just need to include the headers and stick the DLL in the current directory (or a directory pointed to by the PATH environment variable). It means that the end user will know that your library is in the application that he is using and your executable will be smaller as the code that runs remains in the DLL. A LIB is a static library which means that when you compile, the lib gets packaged into the .exe that is generated. You do not need to distribute multiple files in that case and you don't need to distribute an entire library when only part of it is used.
Topic archived. No new replies allowed.