c++cc-libraries

Creating a C library that can be imports as "#include<myLibrary.h>"


I want to create a C static, so the user can use it as follows.

#include<myLibrary.h>

How can I achieve this ?


Solution

  • You first need to decide if you library would be a Dynamic Linked Library (Dll) or a Static Linked Library.

    if the first (dll), read through Building an Import Library and Export File on how to build import library and export file for include.

    if the second (static linked library), you simply provide your .h and .cpp files as part of the package so the users will simply add your files to their project.