Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the static and dynamic libraries of Cmake in C++?

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "the construction of Cmake in C++ static library and dynamic library is what", the content is easy to understand, clear, hope to help you solve their doubts, the following let the editor lead you to study and learn "what is the construction of Cmake static library and dynamic library in C++" this article.

The difference between static Library and dynamic Library

1. Static libraries generally have the extension ".a" or ".lib"; dynamic libraries generally have the extension ".so" or ".dll".

2. The static library will be directly integrated into the target program at compile time, and the successfully compiled executable files can be run independently.

3. The dynamic library will not be put into the connected target program at compile time, so the executable file cannot be run alone.

Build an example

Create a new project cmake02 with the following directories

Content in hello.h

# ifndef HELLO_H#define HELLO_H void HelloFunc (); # endif

Content in hello.cpp

# include "hello.h" # include using namespace std; void HelloFunc () {cout

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report