Basic Operations for Compiling with gcc and g++

Generally, compilation requires support from library files. For example, static library files and dynamic library files. On Windows, .lib files are static library files. .dll files are dynamic library files. The suffix for library files is as follows: The suffix for static library files is .a. The suffix for dynamic library files is .so. The … Read more

How to Determine the Compiler Toolchain Used for Dynamic or Static Libraries in Linux

How to Determine the Compiler Toolchain Used for Dynamic or Static Libraries in Linux

I assisted a colleague with a problem and wrote a summary. The background is that code was ported from one Linux platform to another, and the two platforms have different compiler toolchains. Due to multiple collaborators, some libraries were not updated, and after porting, it was unclear which platform the library originated from. Some might … Read more

C++ Library File and Header File Writing Tutorial

C++ Library File and Header File Writing Tutorial

This article introduces how to generate library files on a Linux system and how to write header files to use the library functions. 1. Writing Library Files As we know, in a C++ project, the file containing the main() function will generate an executable program upon compilation. On the other hand, the code that does … Read more

Building Static and Dynamic Libraries with CMake

Building Static and Dynamic Libraries with CMake

Clickthe blue text Follow us In a previous article, we discussed how to use CMake to compile “hello world”. This article will cover building static and dynamic libraries. Link to the previous article: “CMake, a Build Tool for Large Projects” For an understanding of static and dynamic libraries, you can refer to the previous articles: … Read more

CMake Learning Summary – Part Three

CMake Learning Summary - Part Three

CMake Learning Summary (Part One) CMake Learning Summary (Part Two) About the Concepts of Dynamic Libraries and Static Libraries: Creating and Using Static Link Libraries in C Hello everyone, in the previous CMake article, we also left a question to implement at the end of the article, which is to put the source files in … Read more

CMake: How to Link Shared Libraries

CMake: How to Link Shared Libraries

ClickBlue Text Follow Us CMake is a simple build tool that saves us from designing complex Makefiles. The author has previously organized two related articles as follows: “CMake, a Build Tool for Large Projects” “CMake Static and Dynamic Library Construction” Today’s article continues to expand on the project discussed in the previous article. If you … Read more

Getting Started with CMake: A Practical Guide

Getting Started with CMake: A Practical Guide

0. Introduction Recently, I worked on a project using CLION for building, which uses CMakeLists.txt for management. To enhance my learning, I found a comprehensive introductory article by an expert, which includes both text and code. This article summarizes the key points I learned from it. The original author’s GitHub address: https://github.com/wzpan/cmake-demo. 1. Single Source … Read more

Building And Using Library Files In CMake

Building And Using Library Files In CMake

Background CMake CMake is a cross-platform open-source build tool used to manage and automate the build process of software projects. CMake automatically generates build system files suitable for different compilers and operating systems, such as Makefile and Visual Studio solutions, based on the descriptions in the CMakeLists.txt file. Compilation Types Generally, programs can be compiled … Read more

CMake Mastery (5): Comprehensive Guide to add_library – Static and Dynamic Libraries

CMake Mastery (5): Comprehensive Guide to add_library - Static and Dynamic Libraries

Master the Core Logic of Library Building from Compilation Principles to Industrial Practices 1. Essential Differences Between Static and Dynamic Libraries Core Feature Comparison Feature Static Library (<span>.a</span>/<span>.lib</span>) Dynamic Library (<span>.so</span>/<span>.dll</span>) Linking Method Compiled into the executable file at build time Loaded dynamically at runtime Memory Usage Multiple loads of the same library will consume … Read more