What's the proper way of including cpp libraries?

Hi!.. I've tried many times to add external libraries to my projects but I don't know what to do when they don't include a .lib file already... For example, I want to use an ECS library called FLECS but I can't find any .lib associated with it. This happens with many libraries that I come across. I've heard that you have to build them first or something like that? But I don't know how

Thanks!
Last edited on
The easiest way to add Flecs to a project is to add flecs.c and flecs.h to your source code. These files can be added to both C and C++ projects (the C++ API is embedded in flecs.h). Alternatively you can also build Flecs as a library by using the cmake, meson, bazel or bake buildfiles.


https://github.com/SanderMertens/flecs
(in the Visual Studio toolset case)

You can create an import library for a DLL based on its exports
* Use dumpbin to obtain the exports
* Use the exports to write a .def file
* Use lib to create import library from .def file

For details follow the links below

Andy

How to generate an import library (LIB-file) from a DLL?
https://stackoverflow.com/questions/9946322/how-to-generate-an-import-library-lib-file-from-a-dll

DUMPBIN Reference
https://docs.microsoft.com/en-us/cpp/build/reference/dumpbin-reference

Module-Definition (.Def) Files
https://docs.microsoft.com/en-us/cpp/build/reference/module-definition-dot-def-files

LIB Reference
https://docs.microsoft.com/en-us/cpp/build/reference/lib-reference
Last edited on
some are built for you, and some you have to do yourself.
they should be about ready to go after download, with a visual studio project, a makefile, or something such that all you need to do is compile. A few won't have anything but code and you have to do from scratch.
Thanks a lot for taking the time to respond... All the information you gave me worked wonders... I was able to properly build FLECS as a library and it's now up and running within my project!
Topic archived. No new replies allowed.