为什么我们使用图书馆?(抱歉,我是新北京) [英] Why do we use libraries?(Sorry but i am a newBei)

查看:70
本文介绍了为什么我们使用图书馆?(抱歉,我是新北京)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我想知道为什么我们使用库(静态或共享)。

我们可以通过包含头文件来完成这项工作我也希望

知道究竟是什么链接和加载。

i知道这些都是非常简单和基本的问题。

但是plz帮助我考虑到我是一名新开发者的事实

用C ++。

提前感谢你。

Just Saurabh

Hi all,

I want to know why do we use libraries(static or shared).
We can perform that work by including header files too.I also wish to
know what exactly is linking and loading.
i know these are pretty easy and basic questions.
But plz help me considering the fact that i am a new developer
in C++.
Thanking you in advance.
Just Saurabh

推荐答案

>>我想知道为什么我们使用库(静态或共享)。

你试过谷歌吗? ?
>>I want to know why do we use libraries(static or shared).
Did you try google?
我们也可以通过包含头文件来执行该工作。
We can perform that work by including header files too.



头文件只包含声明(或至少被认为是b $ b),但不是定义。静态/动态库,contian

定义即函数的实现。


HTH,

Divick


Header files contains only the declarations(or at least are supposed
to), but not definitions. Static / dynamic libraries, contian the
definitions i.e the implementation of functions.

HTH,
Divick




Divick写道:

Divick wrote:
我想知道为什么我们使用库(静态或共享)。您是否尝试过谷歌?我们也可以通过包含头文件来执行该工作。
I want to know why do we use libraries(static or shared). Did you try google?We can perform that work by including header files too.

头文件只包含声明(或者至少包含
),但不包含定义。静态/动态库,contian
定义即函数的实现。

HTH,
Divick

Header files contains only the declarations(or at least are supposed
to), but not definitions. Static / dynamic libraries, contian the
definitions i.e the implementation of functions.

HTH,
Divick




谢谢很多迪维克。

雅我试过google.But无法得到我想要的东西。头文件只包含声明(或者至少应该包含声明),但不包含定义。静态/动态库,contian
定义,即函数的实现。



Thanks a lot Divick.
Ya i tried google.But couldnt get what i was looking for. Header files contains only the declarations(or at least are supposed
to), but not definitions. Static / dynamic libraries, contian the
definitions i.e the implementation of functions.



但我们也可以在头文件中定义函数。

文件喜欢< stdio.h>,< iostream.h>包含声明

以及定义。

那么我们为什么还要创建库?

我的意思是创建它们会带来什么好处。

Just Saurabh


But we can define functions in header files too.
Files like <stdio.h>, <iostream.h> contains declarations
as well as definitions.
So why do we bother to create libraries?
I mean what benefit we get by creating them.
Just Saurabh


" Saurabh" < NI ****** @ gmail.com>写道:
"Saurabh" <ni******@gmail.com> writes:
我想知道为什么我们使用库(静态或共享)。


一个答案是:因为使用库可以使程序员的生活更方便。一个库

包含并提供一些可以使用的功能,而不用考虑它的实现。


以例如C ++中输出的功能。

如果你想在输出中写42,你只需要b / b
包含头文件''iostream''并使用合适的

从库中构造。例如


[[[

#include< iostream>

int main(){

std :: cout<< 42<< std :: endl;

返回0;

}

]]]


Isn'那很酷吗?想象一下,你应该自己编写

输出功能。您可以将

库视为节省时间。 (好吧,他们可能带来新的

库链接特定问题。;-)


BTW通常没有必要指定

各自的库包含构建过程中std-namespace的功能



我们也可以通过包含头文件来执行该工作。也希望知道究竟是什么链接和加载。


链接是将库和其他

代码组合在一起的过程。链接是实现一个

程序实际上使用库的功能。

我知道这些是非常简单和基本的问题。


你怎么知道的? ;-)你是否已经知道答案

这是一个测试 - 如果是其他人知道的问题?

但是PLZ帮助我考虑我是C ++新开发者的事实。
I want to know why do we use libraries(static or shared).
One answer is: because the use of libraries can make
programmers life much more convenient. A library
contains and provides some functionality that can be
used without thinking much about its implementation.

Take for example the functionality of output in C++.
If you want to write 42 to the output you simply
include the header-file ''iostream'' and use a suitable
construct from the library. E.g.

[[[
#include <iostream>
int main() {
std::cout << 42 << std::endl;
return 0;
}
]]]

Isn''t that cool? Imagine you should have written that
output-functionality on your own. You could regard
libraries as time-savers. (Ok, they may bring new
library-linking-specific problems. ;-) )

BTW typically there is no need to specify the
respective library that contains the functionality of
the std-namespace in the build-process.
We can perform that work by including header files too.I also wish to
know what exactly is linking and loading.
Linking is the process of bringing a library and other
code together. Linking is the realization that a
program actually uses the functionality of a library.
i know these are pretty easy and basic questions.
How do you know? ;-) Do you already know the answers
and this is kind of a test-if-the-others-know-too-question?
But plz help me considering the fact that i am a new developer
in C++.




睁大眼睛! ; o)

HTH



Keep your eyes open! ;o)
HTH


这篇关于为什么我们使用图书馆?(抱歉,我是新北京)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆